From bd6515d5871238514dab001bcf0c062f0f25d721 Mon Sep 17 00:00:00 2001 From: TeamworkGuy2 Date: Thu, 22 Nov 2018 16:34:26 +0000 Subject: [PATCH 1/2] [cached-path-relative] Add cached-path-relative@1.0.2 definition --- .../cached-path-relative-tests.ts | 7 ++++++ types/cached-path-relative/index.d.ts | 8 +++++++ types/cached-path-relative/tsconfig.json | 23 +++++++++++++++++++ types/cached-path-relative/tslint.json | 1 + 4 files changed, 39 insertions(+) create mode 100644 types/cached-path-relative/cached-path-relative-tests.ts create mode 100644 types/cached-path-relative/index.d.ts create mode 100644 types/cached-path-relative/tsconfig.json create mode 100644 types/cached-path-relative/tslint.json diff --git a/types/cached-path-relative/cached-path-relative-tests.ts b/types/cached-path-relative/cached-path-relative-tests.ts new file mode 100644 index 0000000000..22e6af97df --- /dev/null +++ b/types/cached-path-relative/cached-path-relative-tests.ts @@ -0,0 +1,7 @@ +import cachedPathRelative = require("cached-path-relative"); + +function browserifyTest() { + const file = "file.txt"; + const m1: string = cachedPathRelative("./", file).replace(/\\/g, '/'); + return m1; +} diff --git a/types/cached-path-relative/index.d.ts b/types/cached-path-relative/index.d.ts new file mode 100644 index 0000000000..56076870bc --- /dev/null +++ b/types/cached-path-relative/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for cached-path-relative 1.0 +// Project: https://github.com/ashaffer/cached-path-relative +// Definitions by: TeamworkGuy2 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function cachedPathRelative(from: string, to: string): string; + +export = cachedPathRelative; diff --git a/types/cached-path-relative/tsconfig.json b/types/cached-path-relative/tsconfig.json new file mode 100644 index 0000000000..e69970c325 --- /dev/null +++ b/types/cached-path-relative/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "cached-path-relative-tests.ts" + ] +} \ No newline at end of file diff --git a/types/cached-path-relative/tslint.json b/types/cached-path-relative/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/cached-path-relative/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From a169bc5dda5c595439062712c4d0429b4def512d Mon Sep 17 00:00:00 2001 From: TeamworkGuy2 Date: Sat, 24 Nov 2018 14:26:28 +0000 Subject: [PATCH 2/2] [cached-path-relative] Add documentation to new definition --- types/cached-path-relative/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/cached-path-relative/index.d.ts b/types/cached-path-relative/index.d.ts index 56076870bc..b2af5ea81c 100644 --- a/types/cached-path-relative/index.d.ts +++ b/types/cached-path-relative/index.d.ts @@ -3,6 +3,11 @@ // Definitions by: TeamworkGuy2 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/** + * Memoize the results of the path.relative function. path.relative can be an expensive operation + * if it happens a lot, and its results shouldn't change for the same arguments. + * Use it just like your normal path.relative, but it's memoized. + */ declare function cachedPathRelative(from: string, to: string): string; export = cachedPathRelative;