checker-factory
Advanced tools
Comparing version 1.0.0 to 2.0.0
@@ -7,3 +7,2 @@ 'use strict'; | ||
* Creates a new CheckerFactory | ||
* @param {String} name - name of Checker (e.g. string, array, shape) | ||
* @param {String|Function} [validator] - If String, typeof is performed to match the type | ||
@@ -13,3 +12,3 @@ * If Function, the function is executed. The function should return an Error if invalid | ||
*/ | ||
module.exports = function (name, validator) { | ||
module.exports = function (validator) { | ||
return { | ||
@@ -16,0 +15,0 @@ /** |
{ | ||
"name": "checker-factory", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"description": "Checker Factory used by Deku Prop Type Validators", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -20,5 +20,5 @@ # Checker Factory | ||
const numberChecker = checkerFactory('number', 'number') | ||
const numberChecker = checkerFactory('number') | ||
numberChecker.validate('hello', 'age') | ||
numberChecker.validate('age') | ||
// => TypeError: Expected age to be of type `number`, but got `string` | ||
@@ -29,3 +29,3 @@ | ||
const requiredString = checkerFactory('string', 'string').isRequired | ||
const requiredString = checkerFactory('string').isRequired | ||
@@ -35,3 +35,3 @@ requiredString.validate(undefined, 'name') | ||
const evenNumberChecker = checkerFactory('evenNumber', (prop, key) => { | ||
const evenNumberChecker = checkerFactory((prop, key) => { | ||
if (prop % 2 === 1) { | ||
@@ -38,0 +38,0 @@ return new Error(`Expected ${key} to be an even number`) |
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
6177
41