Filter an array of objects to a specific OS
$ npm install os-filter-obj
const osFilterObj = require('os-filter-obj');
const objects = [{
os: 'linux',
arch: 'x64',
foo: 'unicorn',
bar: 'cow'
}, {
os: 'darwin',
arch: 'x64',
foo: 'unicorn',
bar: 'cow'
},{
os: 'win32',
arch: 'x64',
foo: 'unicorn',
bar: 'cow'
}];
osFilterObj(objects);
/*
[{
os: 'linux',
arch: 'x64',
foo: 'unicorn',
bar: 'cow'
}];
*/
Returns an Array
with the filtered objects.
Type: Array
The Array
to filter.
MIT © Kevin Mårtensson