findDeep

Type:Function
Status:stable
Since:1.0.0
Platform:jsnode
@blackbyte.sugar.shared.object

This function take an object and a filter function that will be called for each properties of the object and that will return true or false depending on the property you want to keep or not.

Params

  1. object*-Object

    The object to search in

  2. filter*-Function

    The filter function that take as parameter the property itself, and the property name

Return

  1. -Object

    The searched object

Example

import { findDeep } from '@blackbyte/sugar/object';
findDeep ({
   coco: 'hello',
   plop: true,
   sub: {
     property: 'world'
   }
}, ({key, item}) => typeof item === 'string');
// {
//   coco: 'hello',
//   sub: {
//     property: 'world'
//   }
// }

Todo

  • testsnormal