@lxfriday/get-object-value

1.0.3 • Public • Published

@lxfriday/get-object-value

get object inner value

install

npm i @lxfriday/get-object-value -S
# or
yarn add @lxfriday/get-object-value

params

smoothScrollTo(ref, pos[, rate])

  • obj {object} required, target object
  • keys {array} required, key array, like object.a.b.c.d.e => ['a', 'b', 'c', 'd', 'e']
  • defaultRet {any} if not found or error, will return defaultRet

usage

const obj = {
      a: {
        b: {
          c: {
            d: {
              e: 'abcde',
            },
          },
        },
      },
    }
// not found
console.log('result => ', secureGetValue(obj, ['a', 'b', 'c', 'd', 'e', 'f'], 'not found'))
// abcde
console.log('result => ', secureGetValue(obj, ['a', 'b', 'c', 'd', 'e'], 'not found'))

Readme

Keywords

Package Sidebar

Install

npm i @lxfriday/get-object-value

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

4 kB

Total Files

7

Last publish

Collaborators

  • lxfriday