Socket
Book a DemoInstallSign in
Socket

has-keys

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

has-keys

Returns true if the given object has all of the specified keys.

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

has-keys NPM version

Returns true if the given object has all of the specified keys.

Install

Install with npm

$ npm i has-keys --save

Usage

var hasKeys = require('has-keys');

var obj = {a: 'a', b: 'b', c: 'c'};

hasKeys(obj, 'a');
//=> true

hasKeys(obj, ['a', 'b']);
//=> true

hasKeys(obj, ['a', 'b', 'c']);
//=> true

hasKeys(obj, ['a', 'b', 'c', 'd']);
//=> false
  • get-value: Use property paths (a.b.c) to get a nested value from an object.
  • has-any: Returns true if an object has any of the specified keys.
  • has-value: Returns true if a value exists, false if empty. Works with deeply nested values using… more
  • has-any-deep: Return true if key exists deeply on the given object.
  • has-own-deep: Returns true if an object has an own, nested property using dot notation paths ('a.b.c').

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright © 2015 Jon Schlinkert Released under the MIT license.

This file was generated by verb-cli on June 02, 2015.

Keywords

any

FAQs

Package last updated on 02 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts