diff options
author | anonymous | 2022-09-21 12:46:08 -0400 |
---|---|---|
committer | anonymous | 2022-09-21 12:46:08 -0400 |
commit | 8ace93096ad0116d3d30790cd6ed3a09266b50eb (patch) | |
tree | dce501cfd005ba955eaa6a894f590ec2a9e38b60 | |
parent | 33a84bb2acf9626fa86c2c165b91b66a718e1526 (diff) |
add context if not declared
-rw-r--r-- | graffiti.js | 5 |
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() } |