summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortheia2022-08-03 09:07:59 -0400
committertheia2022-08-03 09:07:59 -0400
commit99db926be7131afbf0fe90a4366abb591b3db230 (patch)
treedce501cfd005ba955eaa6a894f590ec2a9e38b60
parent3e22139af5b2bb312cfbe6771316be64f433035a (diff)
add context if not declared
-rw-r--r--graffiti.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/graffiti.js b/graffiti.js
index 7a9c168..1741452 100644
--- a/graffiti.js
+++ b/graffiti.js
@@ -202,6 +202,11 @@ export default class {
throw new Error("_to must be an array")
}
+ // Add an open context if none is declared
+ if (!object._inContextIf) {
+ object._inContextIf = [{}]
+ }
+
// Pre-generate the object's ID if it does not already exist
if (!object._id) object._id = randomString()
}