question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add flattenProps (or mergeAllProps) function

See original GitHub issue

Example 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:closed
  • Created 6 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
char0ncommented, Sep 23, 2017

Note: added to cookbook

1reaction
char0ncommented, Sep 23, 2017

Will incorporate into ramda-adjunct under name mergeProps and will add to ramda cookbook. Thanks all!

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found