mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-29 09:55:50 +08:00
Merge pull request #5610 from chrootsu/lodash-isPlainObject
lodash: changed _.isPlainObject() method
This commit is contained in:
@@ -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
31
lodash/lodash.d.ts
vendored
@@ -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 {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user