Skip to content

Commit

Permalink
oh right this makes total sense js
Browse files Browse the repository at this point in the history
  • Loading branch information
RedMan13 committed Aug 17, 2024
1 parent 23529bd commit dbb193b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/compiler/jsexecute.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,19 +637,19 @@ runtimeFunctions.get = `const get = (obj, keyPath) => {
runtimeFunctions.set = `const set = (obj, keyPath, val) => {
const [root, key] = _resolveKeyPath(obj, keyPath);
if (!root) return '';
return root.set?.(key) ?? root[key] = val;
return root.set?.(key) ?? (root[key] = val);
}`;

runtimeFunctions.remove = `const remove = (obj, keyPath) => {
const [root, key] = _resolveKeyPath(obj, keyPath);
if (!root) return '';
return root.delete?.(key) ?? root.remove?.(key) ?? delete root[key];
return root.delete?.(key) ?? root.remove?.(key) ?? (delete root[key]);
}`;

runtimeFunctions.includes = `const includes = (obj, keyPath) => {
const [root, key] = _resolveKeyPath(obj, keyPath);
if (!root) return false;
return root.has?.(key) ?? key in root;
return root.has?.(key) ?? (key in root);
}`;

/**
Expand Down

0 comments on commit dbb193b

Please sign in to comment.