Skip to content

Commit

Permalink
fix $ symbol keys
Browse files Browse the repository at this point in the history
  • Loading branch information
benStre committed Nov 23, 2023
1 parent 3b9466f commit 14bd428
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions runtime/pointers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export abstract class Ref<T = any> extends EventTarget {
}

handler.get = (_, key) => {

// array iterator
if (key === Symbol.iterator) {
// array
Expand All @@ -148,15 +149,15 @@ export abstract class Ref<T = any> extends EventTarget {
else throw new Error("Cannot iterate over pointer properties");
}

if (typeof key == "symbol") return pointer.val?.[key];

// special array $ methods (map, ...)
if (pointer.val instanceof Array) {
if (typeof key == "string" && key in arrayFunctions) return arrayFunctions[key];
}


if (force_pointer_properties) return PointerProperty.get(pointer, <keyof typeof pointer>key, true);
else {
// TODO: handle typeof key == "symbol" (currently not supported in DATEX)
if (!(pointer.val instanceof Array) && ![...pointer.getKeys()].includes(key)) {
throw new ValueError("Property "+key.toString()+" does not exist in value");
}
Expand Down

0 comments on commit 14bd428

Please sign in to comment.