Merge pull request #5610 from chrootsu/lodash-isPlainObject

lodash: changed _.isPlainObject() method
This commit is contained in:
Masahiro Wakame
2015-09-03 02:03:37 +09:00
2 changed files with 27 additions and 14 deletions

View File

@@ -1284,6 +1284,12 @@ result = <boolean>_(1).isNumber();
result = <boolean>_<any>([]).isNumber();
result = <boolean>_({}).isNumber();
// _.isPlainObject
result = <boolean>_.isPlainObject(any);
result = <boolean>_(1).isPlainObject();
result = <boolean>_<any>([]).isPlainObject();
result = <boolean>_({}).isPlainObject();
// _.isRegExp
result = <boolean>_.isRegExp(any);
result = <boolean>_(1).isRegExp();
@@ -1527,10 +1533,6 @@ class Stooge {
) { }
}
result = <boolean>_.isPlainObject(new Stooge('moe', 40));
result = <boolean>_.isPlainObject([1, 2, 3]);
result = <boolean>_.isPlainObject({ 'name': 'moe', 'age': 40 });
result = <string[]>_.keys({ 'one': 1, 'two': 2, 'three': 3 });
result = <string[]>_({ 'one': 1, 'two': 2, 'three': 3 }).keys().value();

31
lodash/lodash.d.ts vendored
View File

@@ -6415,6 +6415,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<T, TWrapper> {
/**
* see _.isPlainObject
*/
isPlainObject(): boolean;
}
//_.isRegExp
interface LoDashStatic {
/**
@@ -7205,16 +7226,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 {
/**