Skip to content

Commit

Permalink
mapOf and setOf validators
Browse files Browse the repository at this point in the history
  • Loading branch information
conartist6 committed Sep 3, 2019
1 parent bef0803 commit e08542d
Show file tree
Hide file tree
Showing 9 changed files with 1,607 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,6 @@
## 15.7.3
* [New] Add `.tupleOf`, `.iterableOf`, `.mapOf`, and `.setOf` ([#289](https://github.com/facebook/prop-types/pull/289))

## 15.7.2
* [Fix] ensure nullish values in `oneOf` do not crash ([#256](https://github.com/facebook/prop-types/issues/256))
* [Fix] move `loose-envify` back to production deps, for browerify usage ([#203](https://github.com/facebook/prop-types/issues/203))
Expand Down
12 changes: 12 additions & 0 deletions README.md
Expand Up @@ -103,6 +103,18 @@ MyComponent.propTypes = {
// An array of a certain type
optionalArrayOf: PropTypes.arrayOf(PropTypes.number),

// A two item array of [string, number]
optionalTupleOf: PropTypes.tupleOf([PropTypes.string, PropTypes.number]),

// An iterable of a certain type
optionalIterableOf: PropTypes.iterableOf(PropTypes.number),

// An es6 Map containing certain types of keys and values
optionalMapOf: PropTypes.mapOf([PropTypes.string, PropTypes.number]),

// An es6 Set containing certain types of values
optionalSetOf: PropTypes.setOf(PropTypes.number),

// An object with property values of a certain type
optionalObjectOf: PropTypes.objectOf(PropTypes.number),

Expand Down

0 comments on commit e08542d

Please sign in to comment.