Skip to content

afeiship/next-pick-by

Repository files navigation

next-pick-by

Pick value from object by callback.

version license size download

installation

npm install -S @jswork/next-pick-by

usage

import '@jswork/next-pick-by';

const object = {
  'a': 1,
  'c': 'c-value',
  'k1': 111,
  'k2': 222,
  'k3': 333,
  some: {
    what: {
      and: {
        deep: {
          one: 1
        }
      }
    }
  }
};

const res = nx.pickBy(object, function (key, value, item) {
  return typeof(value) === 'number';
});

// { a: 1, k1: 111, k2: 222, k3: 333 }

license

Code released under the MIT license.