From 81b60b07a3617be29208f198ced552d8808ca7c1 Mon Sep 17 00:00:00 2001 From: Jack Works Date: Mon, 20 Feb 2017 12:46:38 +0800 Subject: [PATCH] New package: parse-unit Signed-off-by: Jack Works --- parse-unit/index.d.ts | 7 +++++++ parse-unit/parse-unit-tests.ts | 4 ++++ parse-unit/tsconfig.json | 23 +++++++++++++++++++++++ parse-unit/tslint.json | 1 + 4 files changed, 35 insertions(+) create mode 100644 parse-unit/index.d.ts create mode 100644 parse-unit/parse-unit-tests.ts create mode 100644 parse-unit/tsconfig.json create mode 100644 parse-unit/tslint.json diff --git a/parse-unit/index.d.ts b/parse-unit/index.d.ts new file mode 100644 index 0000000000..238f3cfc06 --- /dev/null +++ b/parse-unit/index.d.ts @@ -0,0 +1,7 @@ +// Type definitions for parse-unit 1.0 +// Project: https://github.com/mattdesl/parse-unit +// Definitions by: Jack Works +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function parse(value: string): [number, string]; +export = parse; diff --git a/parse-unit/parse-unit-tests.ts b/parse-unit/parse-unit-tests.ts new file mode 100644 index 0000000000..772641c302 --- /dev/null +++ b/parse-unit/parse-unit-tests.ts @@ -0,0 +1,4 @@ +import parse = require('parse-unit') +let [number, length] = parse('10px') +number === 50 +length === 'px' diff --git a/parse-unit/tsconfig.json b/parse-unit/tsconfig.json new file mode 100644 index 0000000000..4f0a626508 --- /dev/null +++ b/parse-unit/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "parse-unit-tests.ts" + ] +} diff --git a/parse-unit/tslint.json b/parse-unit/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/parse-unit/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" }