mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2024-12-25 00:11:36 +01:00
Added function to filter object keys
This commit is contained in:
parent
8296c6129e
commit
497a1a0ad3
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "foris",
|
"name": "foris",
|
||||||
"version": "0.1.0-beta.3",
|
"version": "0.1.0-beta.4",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "foris",
|
"name": "foris",
|
||||||
"version": "0.1.0-beta.3",
|
"version": "0.1.0-beta.4",
|
||||||
"description": "Set of components and utils for Foris and its plugins.",
|
"description": "Set of components and utils for Foris and its plugins.",
|
||||||
"author": "CZ.NIC, z.s.p.o.",
|
"author": "CZ.NIC, z.s.p.o.",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
@ -18,3 +18,11 @@ export function withoutUndefinedKeys(instance) {
|
||||||
{},
|
{},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Return copy of passed object that has only desired keys. */
|
||||||
|
export function onlySpecifiedKeys(object, desiredKeys) {
|
||||||
|
return desiredKeys.reduce(
|
||||||
|
(accumulator, key) => { accumulator[key] = object[key]; return accumulator; },
|
||||||
|
{},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user