Neurotic Pumpkin Murderer

    deep-find

    1.1.0 • Public • Published

    deep-find NPM version Build Status Dependency Status

    find value for deep nested keys

    Install

    $ npm install --save deep-find

    Usage

    JavaScript

    var deepFind = require('deep-find');
     
    var obj = {
      employee:{
        name: {
          first: 'yash',
          last: 'singh'
        }
      }
    }
     
    deepFind(obj, 'employee.name.first');

    Methods

    var deepFind = require('deep-find');

    deepFind([object], [array])

    pass array as argument

    var deepFind = require('deep-find');
    var obj = {
      employees: [{
        name: {
          first: 'yash',
          last: 'singh'
        }
      }, {
        name: {
          first: 'ruby',
          last: 'singh'
        }
      }]
    }
     
    var value = deepFind(obj, ['employees[0]', 'name', 'first']);

    deepFind([object], [string])

    pass string as argument

    var deepFind = require('deep-find');
    var obj = {
      employees: [{
        name: {
          first: 'yash',
          last: 'singh'
        }
      }, {
        name: {
          first: 'ruby',
          last: 'singh'
        }
      }]
    }
     
    var value = deepFind(obj, 'employees[0].name.first');

    Run Test

    npm test

    Benchmark

    node benchmark.js
    regular search x 1,212,008 ops/sec ±1.61% (81 runs sampled)

    Contribute or Report Issue

    For bugs and feature requests, please create an issue.

    License

    MIT © Yashprit Singh

    Install

    npm i deep-find

    DownloadsWeekly Downloads

    6

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    4.41 kB

    Total Files

    4

    Last publish

    Collaborators

    • yashprit