diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index c70f3d667..28c148e75 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -597,6 +597,10 @@ result = _.isDate(new Date()); result = _.isElement(document.body); +result = _.isEmpty([1, 2, 3]); +result = _.isEmpty({}); +result = _.isEmpty(''); + var mergeNames = { 'stooges': [ @@ -672,8 +676,7 @@ var clone = { name: 'moe', luckyNumbers: [13, 27, 34] }; moe == clone; _.isEqual(moe, clone); -_.isEmpty([1, 2, 3]); -_.isEmpty({}); + _.isObject({}); _.isObject(1); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 144b5457d..3b3471415 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2381,6 +2381,24 @@ declare module _ { **/ export function isElement(value: any): boolean; + /** + * 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. + **/ + export function isEmpty(value: any[]): boolean; + + /** + * @see _.isEmpty + **/ + export function isEmpty(value: Dictionary): boolean; + + /** + * @see _.isEmpty + **/ + export function isEmpty(value: string): boolean; + /** * Recursively merges own enumerable properties of the source object(s), that don't resolve * to undefined into the destination object. Subsequent sources will overwrite property @@ -2603,12 +2621,7 @@ declare module _ { **/ export function isEqual(object: any, other: any): boolean; - /** - * Returns true if object contains no values. - * @param object Check if this object has no properties or values. - * @return True if `object` is empty. - **/ - export function isEmpty(object: any): boolean; +