Add flattenProps (or mergeAllProps) function
See original GitHub issueExample on typescript
import { curry, props, mergeAll } from 'ramda'
/**
* Function that does the same as object spread
*
* example:
* // this statements are equal
* let propsCopy = { ...obj.foo, ...obj.bar }
* let propsCopy = flattenProps(['foo', 'bar'], obj)
*/
export const flattenProps = curry<string[], object, object>(function(
propNames: string[],
x: object
): object {
return mergeAll(props(propNames, x))
})
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Note: added to cookbook
Will incorporate into ramda-adjunct under name
mergePropsand will add to ramda cookbook. Thanks all!