deku-prop-types-immutable
v0.2.3
Published
Immutable prop type validation for Deku components
Downloads
6
Maintainers
Readme
deku-prop-types-immutable
Immutable prop type validation for Deku components
Install
npm install --save deku-prop-types-immutable
Usage
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)
Supported types
ImmutablePropTypes.iterable
Validate prop is an Immutable.Iterable
ImmutablePropTypes.iterableOf
Validate each property's value is of a certain type
ImmutablePropTypes.list
Validate prop is an Immutable.List
ImmutablePropTypes.listOf
Validate each value is of a certain type
ImmutablePropTypes.map
Validate prop is an Immutable.Map
ImmutablePropTypes.mapOf
Validate each property's value is of a certain type
ImmutablePropTypes.orderedMap
Validate prop is an Immutable.OrderedMap
ImmutablePropTypes.orderedMapOf
Validate each property's value is of a certain type
ImmutablePropTypes.orderedSet
Validate prop is an Immutable.OrderedSet
ImmutablePropTypes.orderedSetOf
Validate each value is of a certain type
ImmutablePropTypes.record
Validate prop is an Immutable.Record
ImmutablePropTypes.recordOf
Validate each value is of a certain type
ImmutablePropTypes.set
Validate prop is an Immutable.Set
ImmutablePropTypes.setOf
Validate each value is of a certain type
ImmutablePropTypes.seq
Validate prop is an Immutable.Seq
ImmutablePropTypes.seqOf
Validate each value is of a certain type
ImmutablePropTypes.shape
Validate a property's value matches the specified type. This works with Iterable
, Map
, and OrderedMap
, Record
.
ImmutablePropTypes.stack
Validate prop is an Immutable.Stack
ImmutablePropTypes.stackOf
Validate each value is of a certain type
License
MIT © Dustin Specker