combine-same-keys

1.2.0 • Public • Published

combine-same-keys Build Status

Combine all properties sharing the same key into a single object

Install

npm i combine-same-keys

Usage

import combineSameKeys from 'combine-same-keys'

combineSameKeys(
  {
    foo: { color: 'red' },
    bar: { fontSize: 16 }
  },

  {
    foo: {
      backgroundColor: 'gold',
      lineHeight: 0
    }
  },

  { baz: { opacity: 1 } }
)

/*
{ foo: { color: 'red', backgroundColor: 'gold', lineHeight: 0 },
      bar: { fontSize: 16 },
      baz: { opacity: 1 } }
*/

API

combineSameKeys(...args)

args

Type: rest parameter with Object entries

License

MIT © Rafael Rinaldi

Package Sidebar

Install

npm i combine-same-keys

Weekly Downloads

2

Version

1.2.0

License

MIT

Unpacked Size

1.75 kB

Total Files

2

Last publish

Collaborators

  • rafaelrinaldi