diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 76a928aa4..ff8141821 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -638,6 +638,15 @@ result = _.isObject({}); result = _.isObject([1, 2, 3]); result = _.isObject(1); +function Stooge(name, age) { + this.name = name; + this.age = age; +} + +result = _.isPlainObject(new Stooge('moe', 40)); +result = _.isPlainObject([1, 2, 3]); +result = _.isPlainObject({ 'name': 'moe', 'age': 40 }); + var mergeNames = { 'stooges': [ { 'name': 'moe' }, diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 5c1ce82d1..0bc4bca92 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2467,6 +2467,13 @@ declare module _ { **/ export function isObject(value: any): boolean; + /** + * 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. + **/ + export function isPlainObject(value: any): 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