From d28a7929bdfee3c0a2db594492747676c3453f78 Mon Sep 17 00:00:00 2001 From: DomiR Date: Fri, 15 Jan 2016 01:58:39 +0100 Subject: [PATCH] (feature) Add _.isNil --- lodash/lodash-tests.ts | 21 +++++++++++++++++++++ lodash/lodash.d.ts | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 4a0884984..d97800833 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -6151,6 +6151,27 @@ module TestIsNative { } } +// _.isNil +module TestIsNil { + { + let result: boolean; + + result = _.isNil(any); + + result = _(1).isNil(); + result = _([]).isNil(); + result = _({}).isNil(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(1).chain().isNil(); + result = _([]).chain().isNil(); + result = _({}).chain().isNil(); + } +} + // _.isNull module TestIsNull { { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 76d716126..4c6a30c23 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9971,6 +9971,44 @@ declare module _ { isNative(): LoDashExplicitWrapper; } + //_.isNil + interface LoDashStatic { + /** + * Checks if `value` is `null` or `undefined`. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is nullish, else `false`. + * @example + * + * _.isNil(null); + * // => true + * + * _.isNil(void 0); + * // => true + * + * _.isNil(NaN); + * // => false + */ + isNil(value?: any): boolean; + } + + interface LoDashImplicitWrapperBase { + /** + * see _.isNil + */ + isNil(): boolean; + } + + interface LoDashExplicitWrapperBase { + /** + * see _.isNil + */ + isNil(): LoDashExplicitWrapper; + } + //_.isNull interface LoDashStatic { /**