-
Notifications
You must be signed in to change notification settings - Fork 945
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(apollo-client): cache subscriptions
- Loading branch information
1 parent
6250cda
commit 6eb8d10
Showing
2 changed files
with
123 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
export default function pathObject(path: string, obj: any) { | ||
if (!path) return obj | ||
|
||
const splitPaths = path.split(".") | ||
|
||
let pathedObj = obj | ||
|
||
for (let i = 0; i < splitPaths.length; i++) { | ||
const curPath = splitPaths[i] | ||
pathedObj = pathedObj[curPath] | ||
|
||
if (i < splitPaths.length - 1 && typeof pathedObj !== "object") { | ||
pathedObj = undefined | ||
break | ||
} | ||
} | ||
|
||
return pathedObj | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters