Skip to content

Commit

Permalink
Allowed get with multiple property accessors e.g. "a.b"
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom committed Jan 21, 2021
1 parent d8ebd21 commit ca3f3a5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/stormdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,12 @@ class StormDB {
}

get(value) {
let extraPointers;
if (typeof value === "string") extraPointers = value.split(".");
else extraPointers = [value];

let clone = Object.assign(Object.create(Object.getPrototypeOf(this)), this);
clone.pointers = [...clone.pointers, value];
clone.pointers = [...clone.pointers, ...extraPointers];
return clone;
}

Expand Down

0 comments on commit ca3f3a5

Please sign in to comment.