1.0.0 • Published 7 years ago

core-js-plus v1.0.0

Weekly downloads
2
License
BSD
Repository
github
Last release
7 years ago

core-js-plus

Return the value at given object path.

Usage

var test = {
  b: 'ccc',
  d: {
    e: 'fff',
    g: [
      {k: {a: 1}}
    ],
    'test': [
      'grape',
      'orange',
      'carrot'
    ]
  }
}

test.get('b')
// => 'ccc'

test.get('d.g.0.k')
// => {a: 1}

test.get('d.test.2')
// => 'carrot'

// if undefined return default value

test.get('d.ddd', 'def')
// => 'def'

test.get('d.9', 'def')
// => 'def'
1.0.0

7 years ago