diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 7b2a10356..8a14db2d3 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6316,6 +6316,27 @@ module TestIsRegExp { } } +// _.isSafeInteger +module TestIsSafeInteger { + { + let result: boolean; + + result = _.isSafeInteger(any); + + result = _(1).isSafeInteger(); + result = _([]).isSafeInteger(); + result = _({}).isSafeInteger(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isSafeInteger(); + result = _([]).chain().isSafeInteger(); + result = _({}).chain().isSafeInteger(); + } +} + // _.isString module TestIsString { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index aa21e03cd..24bb866a0 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10182,6 +10182,50 @@ declare module _ { isRegExp(): LoDashExplicitWrapper; } + //_.isSafeInteger + interface LoDashStatic { + /** + * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754 + * double precision number which isn't the result of a rounded unsafe integer. + * + * **Note:** This method is based on [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger). + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`. + * @example + * + * _.isSafeInteger(3); + * // => true + * + * _.isSafeInteger(Number.MIN_VALUE); + * // => false + * + * _.isSafeInteger(Infinity); + * // => false + * + * _.isSafeInteger('3'); + * // => false + */ + isSafeInteger(value: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isSafeInteger + */ + isSafeInteger(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isSafeInteger + */ + isSafeInteger(): LoDashExplicitWrapper; + } + //_.isString interface LoDashStatic { /**