Created
March 10, 2023 02:53
-
-
Save prettydiff/4fe22229cc36631ea1b73135ea48333f to your computer and use it in GitHub Desktop.
This file contains 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 characters
const slicer = function (obj, list) { | |
const keys = Object.keys(obj), | |
output = {}; | |
let oIndex = keys.length, | |
lIndex = list.length | |
do { | |
oIndex = oIndex - 1; | |
do { | |
lIndex = lIndex - 1; | |
if (obj[list[lIndex]] !== undefined) { | |
output[list[lIndex]] = obj[list[index]]; | |
} | |
} while (lIndex > 0); | |
} while (oIndex > 0); | |
return output; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment