JSPM

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

Check if object has property

Package Exports

  • hasprop

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 (hasprop) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

hasprop

Check if object has property

Install

npm install hasprop

Usage

var hasProp = require('hasprop');

var foo = {
  bar: {
    baz: {
      qux: 'corge',
      c: [1,2]
    },
    garphly: [{a:'b'}]
  },
  fred: 'plugh'
};

hasProp(foo, 'bar') // true
hasProp(foo, 'foo') // false
hasProp(foo, 'bar.baz') // true
hasProp(foo, 'bar.baz.grault') // false
hasProp(foo, 'fred') // true
hasProp(foo, 'bar.garphly.0') // true
hasProp(foo, 'bar.garphly.0.a') // true
hasProp(foo, 'bar.baz.garphly.1') // false
hasProp(foo, 'bar.baz.corge.garphly.5') // false
hasProp(foo, 'bar.baz.c.1') // true
hasProp(foo, 'bar.baz.c.2') // false

License

MIT