Propable
A collection of prop types that can be used for checking and parsing values.
Installing / Getting Started
Install the package
npm install --save propable
and import/require it
;// OR (pre ES6)var propTypes = propTypes;
Usage
const v = '2';typeof v; // 'string' propTypesnumber; // truepropTypesnumber; // 2typeof propTypesnumber; // 'number' propTypesarray; // falsepropTypesarray; // undefined
You can also define custom prop types using the PropType
class:
; const boolProp = 'myBOOL' // unique type id !!v // parser (returns the parsed value or throws an error); boolProp; // trueboolProp; // false
Developing
This is what you do after you have cloned the repository:
npm installnpm run build
(Install dependencies & build the project.)
Linting
Execute ESLint
npm run lint
Try to automatically fix linting errors
npm run lint:fix
Testing
Execute Jest unit tests using
npm test
Tests are defined in the same directory the module lives in. They are specified in '[module].test.js' files.
Building
To build the project, execute
npm run build
This saves the production ready code into 'dist/'.