Last active
January 14, 2018 08:50
-
-
Save ndabAP/973593ae9d075f3de2745518a68dd2fd to your computer and use it in GitHub Desktop.
How to use Lodash's functional programs functions within a regular pattern
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
/** | |
* This way, you can import the functional program function and use in two ways. You don't have to fear any name collisions. | |
*/ | |
let element = [{key: 1, value: a}, {key: 2, value: b}] | |
// Functional program usage | |
flow([ | |
map(element => omit(['key'])) | |
])(elements) | |
let first = head(element) | |
// Regular usage | |
omit(['key'])(first) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment