(feature) Add _.isLength

This commit is contained in:
DomiR
2016-01-15 01:52:15 +01:00
parent 30e24ce797
commit 2fff06cb70
2 changed files with 64 additions and 0 deletions

View File

@@ -6055,6 +6055,27 @@ module TestIsInteger {
}
}
// _.isLength
module TestIsLength {
{
let result: boolean;
result = _.isLength(any);
result = _(1).isLength();
result = _<any>([]).isLength();
result = _({}).isLength();
}
{
let result: _.LoDashExplicitWrapper<boolean>;
result = _(1).chain().isLength();
result = _<any>([]).chain().isLength();
result = _({}).chain().isLength();
}
}
// _.isMatch
var testIsMatchCustiomizerFn: (value: any, other: any, indexOrKey: number|string) => boolean;
result = <boolean>_.isMatch({}, {});

43
lodash/lodash.d.ts vendored
View File

@@ -9791,6 +9791,49 @@ declare module _ {
isInteger(): LoDashExplicitWrapper<boolean>;
}
//_.isLength
interface LoDashStatic {
/**
* Checks if `value` is a valid array-like length.
*
* **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
* @example
*
* _.isLength(3);
* // => true
*
* _.isLength(Number.MIN_VALUE);
* // => false
*
* _.isLength(Infinity);
* // => false
*
* _.isLength('3');
* // => false
*/
isLength(value?: any): boolean;
}
interface LoDashImplicitWrapperBase<T, TWrapper> {
/**
* @see _.isLength
*/
isLength(): boolean;
}
interface LoDashExplicitWrapperBase<T, TWrapper> {
/**
* @see _.isLength
*/
isLength(): LoDashExplicitWrapper<boolean>;
}
//_.isMatch
interface isMatchCustomizer {
(value: any, other: any, indexOrKey?: number|string): boolean;