Skip to content

Commit

Permalink
Re-introduce toString formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
codepunkt committed Feb 8, 2017
1 parent 946a4cd commit 8dd538c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@ export const omitEmptyValues = (obj) => {
}

// format keyframe styles to string
export const toString = (keyframes) => {
const defaultFormatter = (key, value) => `${key}:${value};`
export const toString = (keyframes, formatter = defaultFormatter) => {
return Object.keys(keyframes).reduce((outer, perc) => {
const value = Object.keys(keyframes[perc]).reduce((inner, prop) => {
return `${inner}${prop}:${keyframes[perc][prop]};`
return `${inner}${formatter(prop, keyframes[perc][prop])}`
}, '')
return `${outer}${perc}{${value}}`
}, '')
Expand Down

0 comments on commit 8dd538c

Please sign in to comment.