Skip to content

Comments

Merge styles into single object#473

Merged
jxnblk merged 5 commits intomasterfrom
merge-styles
May 4, 2019
Merged

Merge styles into single object#473
jxnblk merged 5 commits intomasterfrom
merge-styles

Conversation

@jxnblk
Copy link
Member

@jxnblk jxnblk commented Apr 30, 2019

This change undoes the change in v4.0.0 where the returned value is an array of styles, favoring a merged object instead. The merge implementation is loosely based on the deepmerge package, but only handles objects and does not check for null, falsy or array values. This shouldn't entail a breaking change for most users, but does change the returned values

Partially fixes #471

@codecov-io
Copy link

codecov-io commented Apr 30, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@60dc207). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##             master   #473   +/-   ##
=======================================
  Coverage          ?   100%           
=======================================
  Files             ?      1           
  Lines             ?    173           
  Branches          ?      0           
=======================================
  Hits              ?    173           
  Misses            ?      0           
  Partials          ?      0
Impacted Files Coverage Δ
src/index.js 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 60dc207...6f5d329. Read the comment docs.

@jxnblk jxnblk mentioned this pull request Apr 30, 2019
src/index.js Outdated
// loosely based on deepmerge package
export const merge = (a, b) => {
const result = {}
Object.keys(a).forEach(key => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth doing micro perf optimizations here by using a for loop instead of .keys, .forEach, .reduce, since this is something that will be done a lot.

@jxnblk jxnblk merged commit 67fc9a2 into master May 4, 2019
@jxnblk jxnblk mentioned this pull request May 11, 2019
@jxnblk jxnblk deleted the merge-styles branch May 27, 2019 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

First class support of styled-system by JSS

3 participants