From 961a945b24e0d96b4f502ae5d410a610cf4220fc Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Fri, 14 Aug 2015 02:06:33 +0500 Subject: [PATCH] lodash: changed _.isEmpty() method --- lodash/lodash-tests.ts | 12 ++++++++---- lodash/lodash.d.ts | 29 ++++++++++++++++++----------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 9d87e2a37..f8b706e93 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1062,6 +1062,14 @@ result = _(1).gte(2); result = _([]).gte(2); result = _({}).gte(2); +// _.isEmpty +result = _.isEmpty([1, 2, 3]); +result = _.isEmpty({}); +result = _.isEmpty(''); +result = _([1, 2, 3]).isEmpty(); +result = _({}).isEmpty(); +result = _('').isEmpty(); + // _.isMatch var testIsMatchCustiomizerFn: (value: any, other: any, indexOrKey: number|string) => boolean; result = _.isMatch({}, {}); @@ -1272,10 +1280,6 @@ result = _.isDate(new Date()); result = _.isElement(document.body); -result = _.isEmpty([1, 2, 3]); -result = _.isEmpty({}); -result = _.isEmpty(''); - // _.isEqual (alias: _.eq) result = _.isEqual(1, 1); result = _(1).isEqual(1); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index b2603ee95..62d05be49 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -5861,6 +5861,24 @@ declare module _ { gte(other: any): boolean; } + //_.isEmpty + interface LoDashStatic { + /** + * Checks if value is empty. A value is considered empty unless it’s 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|string|any): boolean; + } + + interface LoDashWrapperBase { + /** + * @see _.isEmpty + */ + isEmpty(): boolean; + } + //_.isMatch interface isMatchCustomizer { (value: any, other: any, indexOrKey?: number|string): boolean; @@ -6594,17 +6612,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|string|any): boolean; - } - //_.isError interface LoDashStatic { /**