From eedec57cba9d6ffa53a00593a112dcbbb5715602 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 2 Mar 2016 23:01:58 +0500 Subject: [PATCH] lodash: added _.isWeakSet --- 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 afbad410d3255a..e102bd32750618 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -7201,6 +7201,37 @@ module TestIsWeakMap { } } +// _.isWeakSet +module TestIsWeakSet { + { + let value: number|WeakSet; + + if (_.isWeakSet(value)) { + let result: WeakSet = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isWeakSet(any); + result = _(1).isWeakSet(); + result = _([]).isWeakSet(); + result = _({}).isWeakSet(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isWeakSet(); + result = _([]).chain().isWeakSet(); + result = _({}).chain().isWeakSet(); + } +} + // _.lt module TestLt { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 02a32583a4609d..035707feb3e344 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -12292,6 +12292,31 @@ declare module _ { isWeakMap(): LoDashExplicitWrapper; } + //_.isWeakSet + interface LoDashStatic { + /** + * Checks if value is classified as a WeakSet object. + * + * @param value The value to check. + * @returns Returns true if value is correctly classified, else false. + */ + isWeakSet(value?: any): value is WeakSet; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isWeakSet + */ + isWeakSet(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isWeakSet + */ + isWeakSet(): LoDashExplicitWrapper; + } + //_.lt interface LoDashStatic { /** @@ -18512,4 +18537,5 @@ declare module "lodash" { // Backward compatibility with --target es5 interface Set {} interface Map {} +interface WeakSet {} interface WeakMap {}