getshortie

2.0.0 • Public • Published

getshortie

Use shortend path names to do similar to lodash get

eg

const shortie = require('shortie')
let obj = {
  the: {
    long: 1,
    name: {
      is: {
        here: 'ryan'
      }
    }
  },
  terrible: {
    long: 'err'
  },
  really: {
    it: {
      is: 3
    }
  },
  a: 4
}

shortie.get(obj, 'a') // 4
shortie.get(obj, 't.l') // 1
shortie.get(obj, 't.n.i.h') // 'ryan'

shortie.path(obj, 't.n.i.h') // 'the.name.is.here'

used in Pilot and Orca to save space when setting effect values on nested objects

Package Sidebar

Install

npm i getshortie

Weekly Downloads

1

Version

2.0.0

License

ISC

Unpacked Size

2.75 kB

Total Files

4

Last publish

Collaborators

  • eckoit