lodash: added _.isMap

This commit is contained in:
Ilya Mochalov
2016-02-24 23:18:37 +05:00
parent dade441471
commit 71f11573b8
2 changed files with 56 additions and 0 deletions
+31
View File
@@ -6620,6 +6620,37 @@ module TestIsLength {
}
}
// _.isMap
module TestIsMap {
{
let value: number|Map<string, number>;
if (_.isMap<string, number>(value)) {
let result: Map<string, number> = value;
}
else {
let result: number = value;
}
}
{
let result: boolean;
result = _.isMap(any);
result = _(1).isMap();
result = _<any>([]).isMap();
result = _({}).isMap();
}
{
let result: _.LoDashExplicitWrapper<boolean>;
result = _(1).chain().isMap();
result = _<any>([]).chain().isMap();
result = _({}).chain().isMap();
}
}
// _.isMatch
module TestIsMatch {
let testIsMatchCustiomizerFn: (value: any, other: any, indexOrKey: number|string) => boolean;
+25
View File
@@ -11516,6 +11516,31 @@ declare module _ {
isLength(): LoDashExplicitWrapper<boolean>;
}
//_.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<K, V>(value?: any): value is Map<K, V>;
}
interface LoDashImplicitWrapperBase<T, TWrapper> {
/**
* @see _.isMap
*/
isMap(): boolean;
}
interface LoDashExplicitWrapperBase<T, TWrapper> {
/**
* @see _.isMap
*/
isMap(): LoDashExplicitWrapper<boolean>;
}
//_.isMatch
interface isMatchCustomizer {
(value: any, other: any, indexOrKey?: number|string): boolean;