Skip to content

Check javascript object properties for existance and type

Notifications You must be signed in to change notification settings

alphashuro/check-props

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

check-props

basic type checking for javascript objects.

usage

const check = require('check');

const object_to_check = {
  foo: 0,
};

check.key('foo', 'string', object_to_check); // returns false
check.key('foo', 'number', object_to_check); // returns true

check.props({ foo: 'number', bar: 'string' }, object_to_check); // returns false

const advanced_object = {
  foo: 0,
  bar: 'super advanced feature',
};

check.props({ foo: 'number', bar: 'string' }, advanced_object); // returns true

About

Check javascript object properties for existance and type

Resources

Stars

Watchers

Forks

Packages

No packages published