From c5ee8975539c8ba4b3fb67dcc2edf51dc7e8c040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Unneb=C3=A4ck?= Date: Thu, 31 Oct 2019 14:57:04 +0000 Subject: [PATCH 1/2] types: Allow sending in undefined as the object --- index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.d.ts b/index.d.ts index a969854..21b0545 100644 --- a/index.d.ts +++ b/index.d.ts @@ -22,11 +22,11 @@ declare const dotProp: { ``` */ get( - object: {[key: string]: any}, + object: {[key: string]: any} | undefined, path: string ): T | undefined; get( - object: {[key: string]: any}, + object: {[key: string]: any} | undefined, path: string, defaultValue: T ): T; @@ -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. From c2b3dcbf12e05f0e119569ba2bedc31ef71ac604 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Unneb=C3=A4ck?= Date: Fri, 1 Nov 2019 10:45:59 +0000 Subject: [PATCH 2/2] docs: Allow sending in undefined as the object --- readme.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/readme.md b/readme.md index 1e2246a..735b0a2 100644 --- a/readme.md +++ b/readme.md @@ -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`