json-diff-ts 5.0.0-alpha.4 → 5.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -708,9 +708,9 @@ function append(basePath, nextSegment) {
708
708
  }
709
709
  var IDENT_RE = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
710
710
  function filterExpression(basePath, filterKey, filterValue) {
711
- const value = typeof filterValue === "number" ? filterValue : `'${filterValue}'`;
712
- const memberAccess = typeof filterKey === "string" && !IDENT_RE.test(filterKey) ? `['${filterKey}']` : `.${filterKey}`;
713
- return `${basePath}[?(@${memberAccess}==${value})]`;
711
+ const escapedValue = `'${filterValue.replace(/'/g, "''")}'`;
712
+ const memberAccess = IDENT_RE.test(filterKey) ? `.${filterKey}` : `['${filterKey.replace(/'/g, "''")}']`;
713
+ return `${basePath}[?(@${memberAccess}==${escapedValue})]`;
714
714
  }
715
715
 
716
716
  // src/jsonCompare.ts