Merge pull request #33135 from jantimon/fix/parseUnit

Allow to pass numbers to parse-unit
This commit is contained in:
Andrew Casey
2019-02-19 18:20:23 -08:00
committed by GitHub
2 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -3,5 +3,5 @@
// Definitions by: Jack Works <https://github.com/Jack-Works>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function parse(value: string): [number, string];
declare function parse(value: string | number): [number, string];
export = parse;
+4
View File
@@ -2,3 +2,7 @@ import parse = require('parse-unit');
const [number, length] = parse('10px');
number === 50;
length === 'px';
parse(10).length === 2;
parse(10)[0] === 10;
parse(10)[1] === '';