Created
December 3, 2019 18:13
-
-
Save hectorromo/e0de8f49d528078dc77d3986fb8b0bfd to your computer and use it in GitHub Desktop.
Revisions
-
hectorromo created this gist
Dec 3, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ function reject(obj, keys) { return Object.keys(obj) .filter(k => !keys.includes(k)) .map(k => Object.assign({}, {[k]: obj[k]})) .reduce((res, o) => Object.assign(res, o), {}); } function pick(obj, keys) { return keys.map(k => k in obj ? {[k]: obj[k]} : {}) .reduce((res, o) => Object.assign(res, o), {}); }