JSPM

object-has

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 139
  • Score
    100M100P100Q64542F
  • License MIT

Checks if path is a direct property of object.

Package Exports

  • object-has

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (object-has) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

object-has

Checks if path is a direct property of object.

MIT License

build:? coverage:?

Install

$ npm install --save object-has 

Usage

For more use-cases see the tests

var has    = require('object-has');
var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };

has(object, 'a[0].b.c');           // => true
has(object, 'a[1]');               // => true
has(object);                       // => false
has(['a', 'b', 'c'], 2);           // => true
has({ a: 'abcde' }, 'a[1]');       // => false
has({ a: ['abcde'] }, 'a[0][2]');  // => true
  • object-at - Get object's property according to the path.
  • object-set - Sets the value at path of object.
  • object-unset - Removes the property at path of object.
  • to-path - Converts string to a property path array.

Contributing

Pull requests and stars are highly welcome.

For bugs and feature requests, please create an issue.