Last active
December 10, 2018 22:39
-
-
Save VitorLuizC/16dc1b129e8facc1e355e452bddedd12 to your computer and use it in GitHub Desktop.
"without" module exports a function. It returns a new object without specified properties.
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 characters
/** | |
* Returns new object without specified properties. | |
* @param {Array.<string>} keys | |
* @param {Object.<string, *>} object | |
* @returns {Object.<string, *>} | |
*/ | |
const without = ( | |
[ key, ...keys ] = [], | |
{ [key]: _, ...object } = {} | |
) => keys.length ? object : without(keys, object); | |
export { without, without as default }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code has an infinite recursion, change:
to: