Skip to content

Commit

Permalink
Allow specifying undefined as the object for .get() and .has() (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
LinusU authored and sindresorhus committed Nov 1, 2019
1 parent 0efd03e commit a6be343
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ declare const dotProp: {
```
*/
get<T>(
object: {[key: string]: any},
object: {[key: string]: any} | undefined,
path: string
): T | undefined;
get<T>(
object: {[key: string]: any},
object: {[key: string]: any} | undefined,
path: string,
defaultValue: T
): T;
Expand Down Expand Up @@ -72,7 +72,7 @@ declare const dotProp: {
//=> true
```
*/
has(object: {[key: string]: any}, path: string): boolean;
has(object: {[key: string]: any} | undefined, path: string): boolean;

/**
@param object - Object to delete the `path` value.
Expand Down
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ Type: `object`

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

You are allowed to pass in `undefined` as the object to the `get` and `has` functions.

#### path

Type: `string`
Expand Down

0 comments on commit a6be343

Please sign in to comment.