From 36bfd4fd3b8d588cf9472cc0f9e299bd93f81f8b Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Tue, 1 Mar 2016 22:41:12 +0500 Subject: [PATCH] lodash: added _.isWeakMap --- lodash/lodash-tests.ts | 31 +++++++++++++++++++++++++++++++ lodash/lodash.d.ts | 26 ++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index daf6ab099..afbad410d 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -7170,6 +7170,37 @@ module TestIsUndefined { } } +// _.isWeakMap +module TestIsWeakMap { + { + let value: number|WeakMap; + + if (_.isWeakMap(value)) { + let result: WeakMap = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isWeakMap(any); + result = _(1).isWeakMap(); + result = _([]).isWeakMap(); + result = _({}).isWeakMap(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isWeakMap(); + result = _([]).chain().isWeakMap(); + result = _({}).chain().isWeakMap(); + } +} + // _.lt module TestLt { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 5285b0e6f..02a32583a 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -12267,6 +12267,31 @@ declare module _ { isUndefined(): LoDashExplicitWrapper; } + //_.isWeakMap + interface LoDashStatic { + /** + * Checks if value is classified as a WeakMap object. + * + * @param value The value to check. + * @returns Returns true if value is correctly classified, else false. + */ + isWeakMap(value?: any): value is WeakMap; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isSet + */ + isWeakMap(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isSet + */ + isWeakMap(): LoDashExplicitWrapper; + } + //_.lt interface LoDashStatic { /** @@ -18487,3 +18512,4 @@ declare module "lodash" { // Backward compatibility with --target es5 interface Set {} interface Map {} +interface WeakMap {}