1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-11-14 17:35:35 +01:00

Merge branch 'filter-keys' into 'dev'

Added function to filter object by keys

See merge request turris/reforis/foris-js!9
This commit is contained in:
Maciej Lenartowicz 2019-09-30 07:51:59 +00:00
commit cbb1382c66
3 changed files with 10 additions and 2 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "foris",
"version": "0.1.0-beta.3",
"version": "0.1.0-beta.4",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"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.",
"author": "CZ.NIC, z.s.p.o.",
"repository": {

View File

@ -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; },
{},
);
}