Merge pull request #5354 from chrootsu/lodash-isEmpty

lodash: changed _.isEmpty() method
This commit is contained in:
Masahiro Wakame
2015-08-17 21:59:56 +09:00
2 changed files with 26 additions and 15 deletions
+8 -4
View File
@@ -1062,6 +1062,14 @@ result = <boolean>_(1).gte(2);
result = <boolean>_([]).gte(2);
result = <boolean>_({}).gte(2);
// _.isEmpty
result = <boolean>_.isEmpty([1, 2, 3]);
result = <boolean>_.isEmpty({});
result = <boolean>_.isEmpty('');
result = <boolean>_([1, 2, 3]).isEmpty();
result = <boolean>_({}).isEmpty();
result = <boolean>_('').isEmpty();
// _.isMatch
var testIsMatchCustiomizerFn: (value: any, other: any, indexOrKey: number|string) => boolean;
result = <boolean>_.isMatch({}, {});
@@ -1282,10 +1290,6 @@ result = <boolean>_.isDate(new Date());
result = <boolean>_.isElement(document.body);
result = <boolean>_.isEmpty([1, 2, 3]);
result = <boolean>_.isEmpty({});
result = <boolean>_.isEmpty('');
// _.isEqual (alias: _.eq)
result = <boolean>_.isEqual(1, 1);
result = <boolean>_(1).isEqual(1);
+18 -11
View File
@@ -5861,6 +5861,24 @@ declare module _ {
gte(other: any): boolean;
}
//_.isEmpty
interface LoDashStatic {
/**
* Checks if value is empty. A value is considered empty unless its an arguments object, array, string, or
* jQuery-like collection with a length greater than 0 or an object with own enumerable properties.
* @param value The value to inspect.
* @return Returns true if value is empty, else false.
**/
isEmpty(value?: any[]|Dictionary<any>|string|any): boolean;
}
interface LoDashWrapperBase<T,TWrapper> {
/**
* @see _.isEmpty
*/
isEmpty(): boolean;
}
//_.isMatch
interface isMatchCustomizer {
(value: any, other: any, indexOrKey?: number|string): boolean;
@@ -6629,17 +6647,6 @@ declare module _ {
isElement(value?: any): boolean;
}
//_.isEmpty
interface LoDashStatic {
/**
* Checks if value is empty. Arrays, strings, or arguments objects with a length of 0 and objects
* with no own enumerable properties are considered "empty".
* @param value The value to inspect.
* @return True if the value is empty, else false.
**/
isEmpty(value?: any[]|Dictionary<any>|string|any): boolean;
}
//_.isError
interface LoDashStatic {
/**