has-properties

Checks if the given object has the required/mandatory properties.


Keywords
hasProperties, type, detect, check, is, has, keys, properties
License
MIT
Install
npm install has-properties@1.1.3

Documentation

has-properties Build Status

Checks if the given object has the required/mandatory properties.

Install

$ npm install --save has-properties

Usage

var positive = {
  name: 'Kitty',
  age: 42,
  type: 'Cat'
};

var negative = {
  name: 'Kitty',
  age: 24
}

var mandatory = ['name', 'type'];

hasProperties(positive, mandatory) // true

hasProperties(negative, mandatory) // false

License

MIT © Hemanth.HM