From afe584b8dac5e33d83848814c974a0210f883d26 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sun, 30 Aug 2015 13:23:45 +0500 Subject: [PATCH] lodash: changed _.isPlainObject() method --- lodash/lodash-tests.ts | 10 ++++++---- lodash/lodash.d.ts | 31 +++++++++++++++++++++---------- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 5fee08b29..ab5a8d983 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1278,6 +1278,12 @@ result = _(1).isNumber(); result = _([]).isNumber(); result = _({}).isNumber(); +// _.isPlainObject +result = _.isPlainObject(any); +result = _(1).isPlainObject(); +result = _([]).isPlainObject(); +result = _({}).isPlainObject(); + // _.isRegExp result = _.isRegExp(any); result = _(1).isRegExp(); @@ -1523,10 +1529,6 @@ class Stooge { ) { } } -result = _.isPlainObject(new Stooge('moe', 40)); -result = _.isPlainObject([1, 2, 3]); -result = _.isPlainObject({ 'name': 'moe', 'age': 40 }); - result = _.keys({ 'one': 1, 'two': 2, 'three': 3 }); result = _({ 'one': 1, 'two': 2, 'three': 3 }).keys().value(); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 9815f472b..d90fc8871 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -6398,6 +6398,27 @@ declare module _ { isNumber(): boolean; } + //_.isPlainObject + interface LoDashStatic { + /** + * Checks if value is a plain object, that is, an object created by the Object constructor or one with a + * [[Prototype]] of null. + * + * Note: This method assumes objects created by the Object constructor have no inherited enumerable properties. + * + * @param value The value to check. + * @return Returns true if value is a plain object, else false. + */ + isPlainObject(value?: any): boolean; + } + + interface LoDashWrapperBase { + /** + * see _.isPlainObject + */ + isPlainObject(): boolean; + } + //_.isRegExp interface LoDashStatic { /** @@ -7198,16 +7219,6 @@ declare module _ { isObject(value?: any): boolean; } - //_.isPlainObject - interface LoDashStatic { - /** - * Checks if value is an object created by the Object constructor. - * @param value The value to check. - * @return True if value is a plain object, else false. - **/ - isPlainObject(value?: any): boolean; - } - //_.keys interface LoDashStatic { /**