JSPM

deep-dot

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

Get a nested property

Package Exports

  • deep-dot

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

Readme

deep-dot

Get a nested property of an object or primitive.

examples

var deep = require('deep-dot')

var obj = {
  a: {
    b: {
      'c.d': [6, '78']
    }
  }
}

// basic usage
console.log(deep(obj, 'a.b.c.d.0') === 6)
console.log(deep(obj, 'a.b.c.d.1.1') === 8)

// attach
obj.deep = deep

// non existent
console.log(obj.deep('x.y') == null)

// array path
console.log(obj.deep(['a', 'b']))

// cute side-effects
console.log(deep('window.location'))
console.log(deep(['a','b','c'], [2]) === 'c')

install

With npm do:

npm install deep-dot

license

MIT