Created
July 25, 2019 15:39
-
-
Save amiralies/a019828ce6686d7ccb4df8fd03880dce to your computer and use it in GitHub Desktop.
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
const filter = (obj, fun) => | |
Object.entries(obj).reduce( | |
(prev, [key, value]) => ({ | |
...prev, | |
...(fun(key, value) ? { [key]: value } : {}) | |
}), | |
{} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment