https://github.com/rafaelrinaldi/combine-same-keys
Combine all properties sharing the same key into a single object
https://github.com/rafaelrinaldi/combine-same-keys
css-in-js extend merge
Last synced: over 1 year ago
JSON representation
Combine all properties sharing the same key into a single object
- Host: GitHub
- URL: https://github.com/rafaelrinaldi/combine-same-keys
- Owner: rafaelrinaldi
- Created: 2018-03-03T19:05:59.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-07-21T22:31:45.000Z (almost 8 years ago)
- Last Synced: 2025-03-20T12:54:39.298Z (over 1 year ago)
- Topics: css-in-js, extend, merge
- Language: JavaScript
- Homepage:
- Size: 59.6 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[url]: https://rinaldi.io
# combine-same-keys [](https://semaphoreci.com/rafaelrinaldi/combine-same-keys)
> Combine all properties sharing the same key into a single object
## Install
npm i combine-same-keys
## Usage
```js
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][url]
---