Skip to content

Commit a6be343

Browse files
LinusUsindresorhus
authored andcommittedNov 1, 2019
Allow specifying undefined as the object for .get() and .has() (#58)
1 parent 0efd03e commit a6be343

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed
 

‎index.d.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ declare const dotProp: {
2222
```
2323
*/
2424
get<T>(
25-
object: {[key: string]: any},
25+
object: {[key: string]: any} | undefined,
2626
path: string
2727
): T | undefined;
2828
get<T>(
29-
object: {[key: string]: any},
29+
object: {[key: string]: any} | undefined,
3030
path: string,
3131
defaultValue: T
3232
): T;
@@ -72,7 +72,7 @@ declare const dotProp: {
7272
//=> true
7373
```
7474
*/
75-
has(object: {[key: string]: any}, path: string): boolean;
75+
has(object: {[key: string]: any} | undefined, path: string): boolean;
7676

7777
/**
7878
@param object - Object to delete the `path` value.

‎readme.md

+2
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ Type: `object`
7777

7878
Object to get, set, or delete the `path` value.
7979

80+
You are allowed to pass in `undefined` as the object to the `get` and `has` functions.
81+
8082
#### path
8183

8284
Type: `string`

0 commit comments

Comments
 (0)
Please sign in to comment.