From ca3f3a509810118e24ed3c0dc41b4adc2e670242 Mon Sep 17 00:00:00 2001 From: Tom Date: Thu, 21 Jan 2021 14:09:47 +0000 Subject: [PATCH] Allowed get with multiple property accessors e.g. "a.b" --- src/stormdb.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/stormdb.js b/src/stormdb.js index a3f2aad..b832975 100644 --- a/src/stormdb.js +++ b/src/stormdb.js @@ -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; }