UNPKG
os-filter-obj
Version:
latest (2.0.0)
2.0.0
1.0.3
1.0.2
1.0.1
1.0.0
Filter an array of objects to a specific OS
github.com/kevva/os-filter-obj
kevva/os-filter-obj
os-filter-obj
/
index.js
8 lines
(6 loc)
•
269 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
'use strict'
;
module
.
exports
=
input
=>
{
const
arch =
require
(
'arch'
)();
const
check
= (
bool, key, val
) => (!bool || !key || key === val);
return
input.
filter
(
x
=>
[process.
platform
, arch].
every
(
(
y, i
) =>
check
(i ===
0
, x.
os
, y) &&
check
(i ===
1
, x.
arch
, y))); };