shared
utils
string
object
is
extension
js
tracking
string
dom
when
selection
position
iframe
event
scroll
console
node
string
project
fs
console
filterObject
Type:Function
Status:stable
Since:1.0.0
Platform:jsnode
@blackbyte.sugar.shared.object
Allow to filter an object using a function. It works the same as the filter method on the Array object type. The passed filter function will have as parameter each object properties and must return true or false depending if you want the passed property in the filtered object
Params
- object*-Object
The object to filter
- filter*-Function
The filter function that take as parameter the property itself, and the property name
Return
- -Object
The filtered object
Example
import { filterObject } from '@blackbyte/sugar/object';
filterObject({
coco: 'hello',
plop: true
}, (key, item) => typeof item === 'string');
// { coco: 'hello' }Todo
- testsnormal
Author
- Olivier Bosselolivier.bossel@gmail.comhttps://blackbyte.space