Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

checker-factory

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

checker-factory - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

3

lib/index.js

@@ -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`)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc