mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-07 01:39:07 +00:00
lodash: changed _.has() method
This commit is contained in:
@@ -1495,7 +1495,15 @@ result = <number>_({ 'a': [{ 'b': { 'c': 3 } }] }).get<number>(['a', '0', 'b', '
|
||||
result = <string>_({ 'a': [{ 'b': { 'c': 3 } }] }).get<string>('a.b.c', 'default');
|
||||
// → 'default'
|
||||
|
||||
result = <boolean>_.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
|
||||
// _.has
|
||||
result = <boolean>_.has({}, '');
|
||||
result = <boolean>_.has({}, 42);
|
||||
result = <boolean>_.has({}, true);
|
||||
result = <boolean>_.has({}, ['', 42, true]);
|
||||
result = <boolean>_({}).has('');
|
||||
result = <boolean>_({}).has(42);
|
||||
result = <boolean>_({}).has(true);
|
||||
result = <boolean>_({}).has(['', 42, true]);
|
||||
|
||||
interface FirstSecond {
|
||||
first: string;
|
||||
|
||||
20
lodash/lodash.d.ts
vendored
20
lodash/lodash.d.ts
vendored
@@ -7135,12 +7135,20 @@ declare module _ {
|
||||
//_.has
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Checks if path is a direct property.
|
||||
* @param object The object to query.
|
||||
* @param path The path to check.
|
||||
* @return True if path is a direct property, else False.
|
||||
**/
|
||||
has(object: any, path: string|string[]): boolean;
|
||||
* Checks if path is a direct property.
|
||||
*
|
||||
* @param object The object to query.
|
||||
* @param path The path to check.
|
||||
* @return Returns true if path is a direct property, else false.
|
||||
*/
|
||||
has(object: any, path: string|number|boolean|Array<string|number|boolean>): boolean;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.has
|
||||
*/
|
||||
has(path: string|number|boolean|Array<string|number|boolean>): boolean;
|
||||
}
|
||||
|
||||
//_.invert
|
||||
|
||||
Reference in New Issue
Block a user