mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-23 04:47:24 +08:00
(feature) Add _.isLength
This commit is contained in:
@@ -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
43
lodash/lodash.d.ts
vendored
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user