Skip to content

Commit

Permalink
replace all instances in safeFieldName (#725)
Browse files Browse the repository at this point in the history
  • Loading branch information
danmarshall authored Sep 30, 2024
1 parent 04e7e8f commit 5e67cf2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/sanddance-specs/src/expr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
* examples: "source.x", "target['x']", "[my.field]"
*/
export function safeFieldName(field: string) {
return field.replace('.', '\\.').replace('[', '\\[').replace(']', '\\]');
return field
.replace(/\./g, '\\.')
.replace(/\[/g, '\\[')
.replace(/\]/g, '\\]')
;
}

/**
Expand Down

0 comments on commit 5e67cf2

Please sign in to comment.