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 +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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
|
|
712
|
-
const memberAccess =
|
|
713
|
-
return `${basePath}[?(@${memberAccess}==${
|
|
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
|