Parses a number or string representing a number with units. The result is a tuple type with the number and unit separated. If the value provided is a number, the default unit is px.
value
px
parseUnit('1px') // Returns [1, 'px']parseUnit('1em', 'em') // Returns [1, 'em'] Copy
parseUnit('1px') // Returns [1, 'px']parseUnit('1em', 'em') // Returns [1, 'em']
String or number to parse.
Default unit if the unit is absent.
Parsed number/unit tuple.
Parses a number or string representing a number with units. The result is a tuple type with the number and unit separated. If the
value
provided is a number, the default unit ispx
.Example