diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 0ccd4dae8..ed3239134 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6055,6 +6055,27 @@ module TestIsInteger { } } +// _.isLength +module TestIsLength { + { + let result: boolean; + + result = _.isLength(any); + + result = _(1).isLength(); + result = _([]).isLength(); + result = _({}).isLength(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isLength(); + result = _([]).chain().isLength(); + result = _({}).chain().isLength(); + } +} + // _.isMatch var testIsMatchCustiomizerFn: (value: any, other: any, indexOrKey: number|string) => boolean; result = _.isMatch({}, {}); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index a8ea000a6..a5c8ff5db 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9791,6 +9791,49 @@ declare module _ { isInteger(): LoDashExplicitWrapper; } + //_.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 { + /** + * @see _.isLength + */ + isLength(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * @see _.isLength + */ + isLength(): LoDashExplicitWrapper; + } + //_.isMatch interface isMatchCustomizer { (value: any, other: any, indexOrKey?: number|string): boolean;