(feature) Add _.isInteger

This commit is contained in:
DomiR
2016-01-15 01:50:14 +01:00
parent c5b2e44a2f
commit 30e24ce797
2 changed files with 67 additions and 6 deletions

View File

@@ -5916,8 +5916,6 @@ module TestIsEqual {
{
let result: _.LoDashExplicitWrapper<boolean>;
result = _(any).chain().isEqual(any);
}
}
@@ -6036,6 +6034,27 @@ module TestIsFunction {
}
}
// _.isInteger
module TestIsInteger {
{
let result: boolean;
result = _.isInteger(any);
result = _(1).isInteger();
result = _<any>([]).isInteger();
result = _({}).isInteger();
}
{
let result: _.LoDashExplicitWrapper<boolean>;
result = _(1).chain().isInteger();
result = _<any>([]).chain().isInteger();
result = _({}).chain().isInteger();
}
}
// _.isMatch
var testIsMatchCustiomizerFn: (value: any, other: any, indexOrKey: number|string) => boolean;
result = <boolean>_.isMatch({}, {});

50
lodash/lodash.d.ts vendored
View File

@@ -82,9 +82,9 @@ added 18 lang methods:
- [x] _.cloneDeepWith
- [x] _.cloneWith
- [ ] _.eq
- [ ] _.isArrayLike
- [ ] _.isArrayLikeObject
- [ ] _.isEqualWith
- [x] _.isArrayLike
- [x] _.isArrayLikeObject
- [x] _.isEqualWith
- [ ] _.isInteger
- [ ] _.isLength
- [ ] _.isMatchWith
@@ -9554,7 +9554,6 @@ declare module _ {
}
//_.isEqual
// TODO tests
interface LoDashStatic {
/**
* Performs a deep comparison between two values to determine if they are
@@ -9749,6 +9748,49 @@ declare module _ {
isFunction(): LoDashExplicitWrapper<boolean>;
}
//_.isInteger
interface LoDashStatic {
/**
* Checks if `value` is an integer.
*
* **Note:** This method is based on [`Number.isInteger`](https://mdn.io/Number/isInteger).
*
* @static
* @memberOf _
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an integer, else `false`.
* @example
*
* _.isInteger(3);
* // => true
*
* _.isInteger(Number.MIN_VALUE);
* // => false
*
* _.isInteger(Infinity);
* // => false
*
* _.isInteger('3');
* // => false
*/
isInteger(value?: any): boolean;
}
interface LoDashImplicitWrapperBase<T, TWrapper> {
/**
* @see _.isInteger
*/
isInteger(): boolean;
}
interface LoDashExplicitWrapperBase<T, TWrapper> {
/**
* @see _.isInteger
*/
isInteger(): LoDashExplicitWrapper<boolean>;
}
//_.isMatch
interface isMatchCustomizer {
(value: any, other: any, indexOrKey?: number|string): boolean;