From a081ef69426414b9d3f42a8a52510ac52fc0a5ad Mon Sep 17 00:00:00 2001 From: Zlatko Andonovski Date: Tue, 29 Nov 2016 10:16:14 +0100 Subject: [PATCH] Definition for left-pad. --- left-pad/index.d.ts | 8 ++++++++ left-pad/left-pad-tests.ts | 15 +++++++++++++++ left-pad/tsconfig.json | 19 +++++++++++++++++++ left-pad/tslint.json | 1 + 4 files changed, 43 insertions(+) create mode 100644 left-pad/index.d.ts create mode 100644 left-pad/left-pad-tests.ts create mode 100644 left-pad/tsconfig.json create mode 100644 left-pad/tslint.json diff --git a/left-pad/index.d.ts b/left-pad/index.d.ts new file mode 100644 index 0000000000..86996ccd47 --- /dev/null +++ b/left-pad/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for left-pad 1.1 +// Project: https://github.com/stevemao/left-pad +// Definitions by: Zlatko Andonovski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function leftPad(str: string|number, len: number, ch?: string|number): string; + +export = leftPad; \ No newline at end of file diff --git a/left-pad/left-pad-tests.ts b/left-pad/left-pad-tests.ts new file mode 100644 index 0000000000..53a08d1a9a --- /dev/null +++ b/left-pad/left-pad-tests.ts @@ -0,0 +1,15 @@ +import leftPad = require("left-pad"); + +// Tests based on examples in https://github.com/stevemao/left-pad#usage + +leftPad("foo", 5); +// => " foo" + +leftPad("foobar", 6); +// => "foobar"' + +leftPad(1, 2, "0"); +// => "01" + +leftPad(17, 5, 0); +// => "00017" \ No newline at end of file diff --git a/left-pad/tsconfig.json b/left-pad/tsconfig.json new file mode 100644 index 0000000000..30b46bb039 --- /dev/null +++ b/left-pad/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "left-pad-tests.ts" + ] +} diff --git a/left-pad/tslint.json b/left-pad/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/left-pad/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" }