Skip to content
This repository was archived by the owner on Mar 28, 2018. It is now read-only.

Commit d50a480

Browse files
authored
Merge pull request #1 from projectwallace/fix-zero-sorting
Fix zero sorting
2 parents 2299f41 + 328a3ed commit d50a480

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const convert = value => {
1919

2020
const raw = parseFloat(value, 10)
2121

22+
if (value == 0) return 0
2223
if (value.match(/px$/)) return raw
2324
if (value.match(/pt$/)) return raw
2425
if (value.match(/em$/)) return raw * 16

test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import cssUnitSort from './'
33

44
test('sorts units', t => {
55
t.deepEqual(cssUnitSort([
6-
'2rem', 'inherit', 'small', '12px', '20px', '60px', '1.5em'
6+
'2rem', 'inherit', 'small', '0', '12px', '20px', '60px', '1.5em'
77
]), [
8-
'60px', '2rem', '1.5em', '20px', 'inherit', 'small', '12px'
8+
'60px', '2rem', '1.5em', '20px', 'inherit', 'small', '12px', '0'
99
])
1010
})

0 commit comments

Comments
 (0)