Skip to content

Commit da8ce1d

Browse files
fix (presets): catch error when number is undefined
1 parent 37f4935 commit da8ce1d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/util/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,12 @@ export const semverCompare = ( version1, operator, version2 ) => {
400400
* // Returns: [["1.5", "rem"], ["2", "vw"]]
401401
*/
402402
export const extractNumbersAndUnits = value => {
403+
if ( typeof value === 'number' ) {
404+
return [ [ value.toString(), 'px' ] ]
405+
} else if ( typeof value !== 'string' ) {
406+
return [ [ '0', 'px' ] ]
407+
}
408+
403409
if ( value.startsWith( 'var' ) ) {
404410
return [ [ value, '' ] ]
405411
}

0 commit comments

Comments
 (0)