deku-prop-types
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -7,2 +7,5 @@ 'use strict'; | ||
return { | ||
get name() { | ||
return name; | ||
}, | ||
get isRequired() { | ||
@@ -39,2 +42,12 @@ this.required = true; | ||
}, | ||
get arrayOf() { | ||
return function (validator) { | ||
return checkerFactory('arrayOf', function (prop) { | ||
prop.forEach(function (p) { | ||
return validator.validate(p); | ||
}); | ||
return true; | ||
}); | ||
}; | ||
}, | ||
get bool() { | ||
@@ -41,0 +54,0 @@ return checkerFactory('bool', 'boolean'); |
{ | ||
"name": "deku-prop-types", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Prop type validation for Deku components", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -52,2 +52,21 @@ # deku-prop-types | ||
Validate prop is an array | ||
### propTypes.arrayOf | ||
Validate prop is an array consisting of a type | ||
```jsx | ||
import {element} from 'deku' | ||
import {validate} from 'deku-prop-types' | ||
const NamesList = ({props}) => <div> | ||
{props.names.map(name => <div>{name}</div>)} | ||
</div> | ||
NamesList.propTypes = { | ||
names: propTypes.arrayOf(propTypes.string) | ||
} | ||
export default validate(NamesList) | ||
``` | ||
### propTypes.bool | ||
@@ -54,0 +73,0 @@ Validate prop is a boolean |
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
8002
91
115