From 71f11573b82cb56bfced420ce20e6084e458bd3c Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Wed, 24 Feb 2016 23:08:15 +0500 Subject: [PATCH] lodash: added _.isMap --- lodash/lodash-tests.ts | 31 +++++++++++++++++++++++++++++++ lodash/lodash.d.ts | 25 +++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 8366f75fc..fed7790ca 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6620,6 +6620,37 @@ module TestIsLength { } } +// _.isMap +module TestIsMap { + { + let value: number|Map; + + if (_.isMap(value)) { + let result: Map = value; + } + else { + let result: number = value; + } + } + + { + let result: boolean; + + result = _.isMap(any); + result = _(1).isMap(); + result = _([]).isMap(); + result = _({}).isMap(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isMap(); + result = _([]).chain().isMap(); + result = _({}).chain().isMap(); + } +} + // _.isMatch module TestIsMatch { let testIsMatchCustiomizerFn: (value: any, other: any, indexOrKey: number|string) => boolean; diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index b77598f13..f52ffddc1 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -11516,6 +11516,31 @@ declare module _ { isLength(): LoDashExplicitWrapper; } + //_.isMap + interface LoDashStatic { + /** + * Checks if value is classified as a Map object. + * + * @param value The value to check. + * @returns Returns true if value is correctly classified, else false. + */ + isMap(value?: any): value is Map; + } + + interface LoDashImplicitWrapperBase { + /** + * @see _.isMap + */ + isMap(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isMap + */ + isMap(): LoDashExplicitWrapper; + } + //_.isMatch interface isMatchCustomizer { (value: any, other: any, indexOrKey?: number|string): boolean;