Created
October 14, 2021 21:16
-
-
Save ronaiza-cardoso/db9b0398fae80987721e374c44009f35 to your computer and use it in GitHub Desktop.
Redroduzindo o comportamento da função `omit` do lodash
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 omit = (obj, filterKeys) => { | |
return Object.keys(obj).reduce( | |
(acc, curr) => | |
filterKeys.every(i => i !== curr) ? { ...acc, [curr]: obj[curr] } : acc, | |
{} | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment