extended-proptypes
Advanced tools
Comparing version 1.2.1 to 1.2.2
{ | ||
"name": "extended-proptypes", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "Useful proptypes for react components", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
[![Build Status](https://travis-ci.org/peterkhayes/extended-proptypes.svg?branch=master)](https://travis-ci.org/peterkhayes/extended-proptypes) [![Coverage Status](https://coveralls.io/repos/github/peterkhayes/extended-proptypes/badge.svg?branch=master)](https://coveralls.io/github/peterkhayes/extended-proptypes?branch=master) | ||
# Extended Prop Types | ||
Useful proptypes for React components. Developed for and tested on ClassDojo's web app. | ||
@@ -18,17 +19,12 @@ | ||
You can also import the whole module and call it on `React.PropTypes`, extending | ||
React's `PropTypes` with all included validators. | ||
If you want to extend React's `PropTypes` with all included validators, you can | ||
import `extended-proptypes/lib/extend`. | ||
```js | ||
import {PropTypes} from "react"; | ||
import ExtendedPropTypes from "extended-proptypes"; | ||
import `extended-proptypes/lib/extend`; | ||
// New options will now be available on React's `PropTypes` export. | ||
ExtendedPropTypes(PropTypes); | ||
class MyComponent extends Component { | ||
static propTypes = { | ||
myDate: PropTypes.date, | ||
mySatanicString: PropTypes.stringMatching(/^6+$/).isRequired, | ||
myEmailAddress: PropTypes.emailAddress.isRequired, | ||
myArrayOrObject: PropTypes.collectionOf(PropTypes.bool), | ||
@@ -39,10 +35,16 @@ }; | ||
Finally, all validators are properties of the module. | ||
Or, you can also import the whole module and call it on `React.PropTypes`. | ||
```js | ||
import {PropTypes} from "react"; | ||
import ExtendedPropTypes from "extended-proptypes"; | ||
// New options will now be available on React's `PropTypes` export. | ||
ExtendedPropTypes(PropTypes); | ||
class MyComponent extends Component { | ||
static propTypes = { | ||
myEmailAddress: ExtendedPropTypes.emailAddress.isRequired, | ||
myDate: PropTypes.date.isRequired, | ||
mySatanicString: PropTypes.stringMatching(/^6+$/).isRequired, | ||
}; | ||
@@ -52,3 +54,2 @@ } | ||
## New Prop Types | ||
@@ -55,0 +56,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38008
46
561
89