From 374978e36aec5e8f263ed2944cda8f0bfe3801de Mon Sep 17 00:00:00 2001 From: Steve Date: Tue, 8 Nov 2016 13:58:24 +0000 Subject: [PATCH] Add definitions for trim (#12292) * Add definitions for trim * comments from PR --- trim/index.d.ts | 12 ++++++++++++ trim/trim-tests.ts | 9 +++++++++ trim/tsconfig.json | 19 +++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 trim/index.d.ts create mode 100644 trim/trim-tests.ts create mode 100644 trim/tsconfig.json diff --git a/trim/index.d.ts b/trim/index.d.ts new file mode 100644 index 0000000000..4d9981052e --- /dev/null +++ b/trim/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for trim 0.01 +// Project: https://www.npmjs.com/package/trim +// Definitions by: Steve Jenkins +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function Trim(str: string): string; +declare namespace Trim { + function left(str: string): string; + function right(str: string): string; +} + +export = Trim; \ No newline at end of file diff --git a/trim/trim-tests.ts b/trim/trim-tests.ts new file mode 100644 index 0000000000..906d2a7b03 --- /dev/null +++ b/trim/trim-tests.ts @@ -0,0 +1,9 @@ +import trim = require("trim"); + +var original: string = " padded string "; + +trim(original); + +trim.left(original); + +trim.right(original); diff --git a/trim/tsconfig.json b/trim/tsconfig.json new file mode 100644 index 0000000000..b063e69e5f --- /dev/null +++ b/trim/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", + "trim-tests.ts" + ] +} \ No newline at end of file