Skip to content

Commit

Permalink
#105 sort prefixes to prepend them
Browse files Browse the repository at this point in the history
closes #105
closes #103
  • Loading branch information
rofrischmann committed Nov 26, 2016
1 parent cf014ce commit 566dbcf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/utils/isPrefixedProperty.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default property => property.match(/^(Webkit|Moz|O|ms)/) !== null
13 changes: 13 additions & 0 deletions modules/utils/sortPrefixedStyle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export function sortPrefixedStyle(style) {
return Object.keys(style).sort((left, right) => {
if (isPrefixed(left) && !isPrefixed(right)) {
return -1
} else if (!isPrefixed(left) && isPrefixed(right)) {
return 1
}
return 0
}).reduce((sortedStyle, prop) => {
sortedStyle[prop] = style[prop]
return sortedStyle
}, { })
}

0 comments on commit 566dbcf

Please sign in to comment.