Immutable prop type validation for Deku components
npm install --save deku-prop-types-immutable
Note: These Prop Type Validators are meant to be used alongside deku-prop-types
function-component.jsx
import {element} from 'deku'
import ImmutablePropTypes from 'deku-prop-types-immutable'
import {PropTypes, validate} from 'deku-prop-types'
const Counter = ({props}) => <div>{props.count}</div>
Counter.propTypes = {
count: PropTypes.number.isRequired,
config: ImmutablePropTypes.map
}
export default validate(Counter)
object-component.jsx
import {element} from 'deku'
import ImmutablePropTypes from 'deku-prop-types-immutable'
import {PropTypes, validate} from 'deku-prop-types'
const Counter = {
propTypes: {
count: PropTypes.number.isRequired,
config: ImmutablePropTypes.map
},
render({props}) {
return <div>{props.count}</div>
}
}
export default validate(Counter)
Validate prop is an Immutable.Iterable
Validate each property's value is of a certain type
Validate prop is an Immutable.List
Validate each value is of a certain type
Validate prop is an Immutable.Map
Validate each property's value is of a certain type
Validate prop is an Immutable.OrderedMap
Validate each property's value is of a certain type
Validate prop is an Immutable.OrderedSet
Validate each value is of a certain type
Validate prop is an Immutable.Record
Validate each value is of a certain type
Validate prop is an Immutable.Set
Validate each value is of a certain type
Validate prop is an Immutable.Seq
Validate each value is of a certain type
Validate a property's value matches the specified type. This works with Iterable
, Map
, and OrderedMap
, Record
.
Validate prop is an Immutable.Stack
Validate each value is of a certain type
MIT © Dustin Specker