json-p3 1.3.0 → 1.3.1
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/json-p3.cjs.js +89 -7
- package/dist/json-p3.esm.js +89 -7
- package/dist/json-p3.iife.js +89 -7
- package/dist/json-p3.iife.min.js +1 -1
- package/dist/json-p3.iife.min.js.map +1 -1
- package/dist/path/functions/match.d.ts +1 -0
- package/dist/path/functions/search.d.ts +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/json-p3.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* json-p3 version 1.3.
|
|
2
|
+
* json-p3 version 1.3.1
|
|
3
3
|
* https://github.com/jg-rp/json-p3
|
|
4
4
|
*
|
|
5
5
|
* MIT License
|
|
@@ -1116,9 +1116,53 @@ class Match {
|
|
|
1116
1116
|
}
|
|
1117
1117
|
fullMatch(pattern) {
|
|
1118
1118
|
const parts = [];
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1119
|
+
let nonCaptureGroup = false;
|
|
1120
|
+
if (!pattern.startsWith("^") && !pattern.startsWith("^(")) {
|
|
1121
|
+
nonCaptureGroup = true;
|
|
1122
|
+
parts.push("^(?:");
|
|
1123
|
+
}
|
|
1124
|
+
parts.push(this.mapRegexp(pattern));
|
|
1125
|
+
if (nonCaptureGroup && !pattern.endsWith("$") && !pattern.endsWith(")$")) {
|
|
1126
|
+
parts.push(")$");
|
|
1127
|
+
}
|
|
1128
|
+
return parts.join("");
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
// See https://datatracker.ietf.org/doc/html/rfc9485#name-ecmascript-regexps
|
|
1132
|
+
mapRegexp(pattern) {
|
|
1133
|
+
let escaped = false;
|
|
1134
|
+
let charClass = false;
|
|
1135
|
+
const parts = [];
|
|
1136
|
+
for (const ch of pattern) {
|
|
1137
|
+
switch (ch) {
|
|
1138
|
+
case ".":
|
|
1139
|
+
if (!escaped && !charClass) {
|
|
1140
|
+
parts.push("(?:(?![\r\n])\\P{Cs}|\\p{Cs}\\p{Cs})");
|
|
1141
|
+
} else {
|
|
1142
|
+
parts.push(ch);
|
|
1143
|
+
escaped = false;
|
|
1144
|
+
}
|
|
1145
|
+
break;
|
|
1146
|
+
case "\\":
|
|
1147
|
+
escaped = true;
|
|
1148
|
+
parts.push(ch);
|
|
1149
|
+
break;
|
|
1150
|
+
case "[":
|
|
1151
|
+
charClass = true;
|
|
1152
|
+
escaped = false;
|
|
1153
|
+
parts.push(ch);
|
|
1154
|
+
break;
|
|
1155
|
+
case "]":
|
|
1156
|
+
charClass = false;
|
|
1157
|
+
escaped = false;
|
|
1158
|
+
parts.push(ch);
|
|
1159
|
+
break;
|
|
1160
|
+
default:
|
|
1161
|
+
escaped = false;
|
|
1162
|
+
parts.push(ch);
|
|
1163
|
+
break;
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1122
1166
|
return parts.join("");
|
|
1123
1167
|
}
|
|
1124
1168
|
}
|
|
@@ -1147,7 +1191,7 @@ class Search {
|
|
|
1147
1191
|
}
|
|
1148
1192
|
}
|
|
1149
1193
|
try {
|
|
1150
|
-
const re = new RegExp(pattern, "u");
|
|
1194
|
+
const re = new RegExp(this.mapRegexp(pattern), "u");
|
|
1151
1195
|
if (this.cacheSize > 0) this.#cache.set(pattern, re);
|
|
1152
1196
|
return !!s.match(re);
|
|
1153
1197
|
} catch (error) {
|
|
@@ -1155,6 +1199,44 @@ class Search {
|
|
|
1155
1199
|
return false;
|
|
1156
1200
|
}
|
|
1157
1201
|
}
|
|
1202
|
+
|
|
1203
|
+
// See https://datatracker.ietf.org/doc/html/rfc9485#name-ecmascript-regexps
|
|
1204
|
+
mapRegexp(pattern) {
|
|
1205
|
+
let escaped = false;
|
|
1206
|
+
let charClass = false;
|
|
1207
|
+
const parts = [];
|
|
1208
|
+
for (const ch of pattern) {
|
|
1209
|
+
switch (ch) {
|
|
1210
|
+
case ".":
|
|
1211
|
+
if (!escaped && !charClass) {
|
|
1212
|
+
parts.push("(?:(?![\r\n])\\P{Cs}|\\p{Cs}\\p{Cs})");
|
|
1213
|
+
} else {
|
|
1214
|
+
parts.push(ch);
|
|
1215
|
+
escaped = false;
|
|
1216
|
+
}
|
|
1217
|
+
break;
|
|
1218
|
+
case "\\":
|
|
1219
|
+
escaped = true;
|
|
1220
|
+
parts.push(ch);
|
|
1221
|
+
break;
|
|
1222
|
+
case "[":
|
|
1223
|
+
charClass = true;
|
|
1224
|
+
escaped = false;
|
|
1225
|
+
parts.push(ch);
|
|
1226
|
+
break;
|
|
1227
|
+
case "]":
|
|
1228
|
+
charClass = false;
|
|
1229
|
+
escaped = false;
|
|
1230
|
+
parts.push(ch);
|
|
1231
|
+
break;
|
|
1232
|
+
default:
|
|
1233
|
+
escaped = false;
|
|
1234
|
+
parts.push(ch);
|
|
1235
|
+
break;
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
return parts.join("");
|
|
1239
|
+
}
|
|
1158
1240
|
}
|
|
1159
1241
|
|
|
1160
1242
|
class Value {
|
|
@@ -1569,6 +1651,7 @@ function lexInsideBracketedSelection(l) {
|
|
|
1569
1651
|
continue;
|
|
1570
1652
|
}
|
|
1571
1653
|
if (!l.environment.strict && l.acceptMatchRun(l.environment.keysPattern)) {
|
|
1654
|
+
// FIXME: fall back to legacy behavior if keysPattern is not the default
|
|
1572
1655
|
switch (l.peek()) {
|
|
1573
1656
|
case "'":
|
|
1574
1657
|
l.ignore(); // ~
|
|
@@ -1579,7 +1662,6 @@ function lexInsideBracketedSelection(l) {
|
|
|
1579
1662
|
l.next();
|
|
1580
1663
|
return lexDoubleQuoteKeyString(l);
|
|
1581
1664
|
case "?":
|
|
1582
|
-
l.ignore(); // ~
|
|
1583
1665
|
l.next();
|
|
1584
1666
|
l.emit(TokenKind.KEYS_FILTER);
|
|
1585
1667
|
l.filterLevel += 1;
|
|
@@ -3684,7 +3766,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
3684
3766
|
apply: apply
|
|
3685
3767
|
});
|
|
3686
3768
|
|
|
3687
|
-
const version = "1.3.
|
|
3769
|
+
const version = "1.3.1";
|
|
3688
3770
|
|
|
3689
3771
|
exports.DEFAULT_ENVIRONMENT = DEFAULT_ENVIRONMENT;
|
|
3690
3772
|
exports.FunctionExpressionType = FunctionExpressionType;
|
package/dist/json-p3.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* json-p3 version 1.3.
|
|
2
|
+
* json-p3 version 1.3.1
|
|
3
3
|
* https://github.com/jg-rp/json-p3
|
|
4
4
|
*
|
|
5
5
|
* MIT License
|
|
@@ -1114,9 +1114,53 @@ class Match {
|
|
|
1114
1114
|
}
|
|
1115
1115
|
fullMatch(pattern) {
|
|
1116
1116
|
const parts = [];
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1117
|
+
let nonCaptureGroup = false;
|
|
1118
|
+
if (!pattern.startsWith("^") && !pattern.startsWith("^(")) {
|
|
1119
|
+
nonCaptureGroup = true;
|
|
1120
|
+
parts.push("^(?:");
|
|
1121
|
+
}
|
|
1122
|
+
parts.push(this.mapRegexp(pattern));
|
|
1123
|
+
if (nonCaptureGroup && !pattern.endsWith("$") && !pattern.endsWith(")$")) {
|
|
1124
|
+
parts.push(")$");
|
|
1125
|
+
}
|
|
1126
|
+
return parts.join("");
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
// See https://datatracker.ietf.org/doc/html/rfc9485#name-ecmascript-regexps
|
|
1130
|
+
mapRegexp(pattern) {
|
|
1131
|
+
let escaped = false;
|
|
1132
|
+
let charClass = false;
|
|
1133
|
+
const parts = [];
|
|
1134
|
+
for (const ch of pattern) {
|
|
1135
|
+
switch (ch) {
|
|
1136
|
+
case ".":
|
|
1137
|
+
if (!escaped && !charClass) {
|
|
1138
|
+
parts.push("(?:(?![\r\n])\\P{Cs}|\\p{Cs}\\p{Cs})");
|
|
1139
|
+
} else {
|
|
1140
|
+
parts.push(ch);
|
|
1141
|
+
escaped = false;
|
|
1142
|
+
}
|
|
1143
|
+
break;
|
|
1144
|
+
case "\\":
|
|
1145
|
+
escaped = true;
|
|
1146
|
+
parts.push(ch);
|
|
1147
|
+
break;
|
|
1148
|
+
case "[":
|
|
1149
|
+
charClass = true;
|
|
1150
|
+
escaped = false;
|
|
1151
|
+
parts.push(ch);
|
|
1152
|
+
break;
|
|
1153
|
+
case "]":
|
|
1154
|
+
charClass = false;
|
|
1155
|
+
escaped = false;
|
|
1156
|
+
parts.push(ch);
|
|
1157
|
+
break;
|
|
1158
|
+
default:
|
|
1159
|
+
escaped = false;
|
|
1160
|
+
parts.push(ch);
|
|
1161
|
+
break;
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1120
1164
|
return parts.join("");
|
|
1121
1165
|
}
|
|
1122
1166
|
}
|
|
@@ -1145,7 +1189,7 @@ class Search {
|
|
|
1145
1189
|
}
|
|
1146
1190
|
}
|
|
1147
1191
|
try {
|
|
1148
|
-
const re = new RegExp(pattern, "u");
|
|
1192
|
+
const re = new RegExp(this.mapRegexp(pattern), "u");
|
|
1149
1193
|
if (this.cacheSize > 0) this.#cache.set(pattern, re);
|
|
1150
1194
|
return !!s.match(re);
|
|
1151
1195
|
} catch (error) {
|
|
@@ -1153,6 +1197,44 @@ class Search {
|
|
|
1153
1197
|
return false;
|
|
1154
1198
|
}
|
|
1155
1199
|
}
|
|
1200
|
+
|
|
1201
|
+
// See https://datatracker.ietf.org/doc/html/rfc9485#name-ecmascript-regexps
|
|
1202
|
+
mapRegexp(pattern) {
|
|
1203
|
+
let escaped = false;
|
|
1204
|
+
let charClass = false;
|
|
1205
|
+
const parts = [];
|
|
1206
|
+
for (const ch of pattern) {
|
|
1207
|
+
switch (ch) {
|
|
1208
|
+
case ".":
|
|
1209
|
+
if (!escaped && !charClass) {
|
|
1210
|
+
parts.push("(?:(?![\r\n])\\P{Cs}|\\p{Cs}\\p{Cs})");
|
|
1211
|
+
} else {
|
|
1212
|
+
parts.push(ch);
|
|
1213
|
+
escaped = false;
|
|
1214
|
+
}
|
|
1215
|
+
break;
|
|
1216
|
+
case "\\":
|
|
1217
|
+
escaped = true;
|
|
1218
|
+
parts.push(ch);
|
|
1219
|
+
break;
|
|
1220
|
+
case "[":
|
|
1221
|
+
charClass = true;
|
|
1222
|
+
escaped = false;
|
|
1223
|
+
parts.push(ch);
|
|
1224
|
+
break;
|
|
1225
|
+
case "]":
|
|
1226
|
+
charClass = false;
|
|
1227
|
+
escaped = false;
|
|
1228
|
+
parts.push(ch);
|
|
1229
|
+
break;
|
|
1230
|
+
default:
|
|
1231
|
+
escaped = false;
|
|
1232
|
+
parts.push(ch);
|
|
1233
|
+
break;
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
return parts.join("");
|
|
1237
|
+
}
|
|
1156
1238
|
}
|
|
1157
1239
|
|
|
1158
1240
|
class Value {
|
|
@@ -1567,6 +1649,7 @@ function lexInsideBracketedSelection(l) {
|
|
|
1567
1649
|
continue;
|
|
1568
1650
|
}
|
|
1569
1651
|
if (!l.environment.strict && l.acceptMatchRun(l.environment.keysPattern)) {
|
|
1652
|
+
// FIXME: fall back to legacy behavior if keysPattern is not the default
|
|
1570
1653
|
switch (l.peek()) {
|
|
1571
1654
|
case "'":
|
|
1572
1655
|
l.ignore(); // ~
|
|
@@ -1577,7 +1660,6 @@ function lexInsideBracketedSelection(l) {
|
|
|
1577
1660
|
l.next();
|
|
1578
1661
|
return lexDoubleQuoteKeyString(l);
|
|
1579
1662
|
case "?":
|
|
1580
|
-
l.ignore(); // ~
|
|
1581
1663
|
l.next();
|
|
1582
1664
|
l.emit(TokenKind.KEYS_FILTER);
|
|
1583
1665
|
l.filterLevel += 1;
|
|
@@ -3682,6 +3764,6 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
3682
3764
|
apply: apply
|
|
3683
3765
|
});
|
|
3684
3766
|
|
|
3685
|
-
const version = "1.3.
|
|
3767
|
+
const version = "1.3.1";
|
|
3686
3768
|
|
|
3687
3769
|
export { DEFAULT_ENVIRONMENT, FunctionExpressionType, JSONPatch, JSONPatchError, JSONPatchTestFailure, JSONPath, JSONPathEnvironment, JSONPathError, JSONPathIndexError, JSONPathLexerError, JSONPathNode, JSONPathNodeList, JSONPathRecursionLimitError, JSONPathSyntaxError, JSONPathTypeError, JSONPointer, Nothing, RelativeJSONPointer, Token, TokenKind, UNDEFINED, apply, compile, index as jsonpatch, index$1 as jsonpath, index$3 as jsonpointer, lazyQuery, query, resolve, version };
|
package/dist/json-p3.iife.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* json-p3 version 1.3.
|
|
2
|
+
* json-p3 version 1.3.1
|
|
3
3
|
* https://github.com/jg-rp/json-p3
|
|
4
4
|
*
|
|
5
5
|
* MIT License
|
|
@@ -1117,9 +1117,53 @@ var json_p3 = (function (exports) {
|
|
|
1117
1117
|
}
|
|
1118
1118
|
fullMatch(pattern) {
|
|
1119
1119
|
const parts = [];
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1120
|
+
let nonCaptureGroup = false;
|
|
1121
|
+
if (!pattern.startsWith("^") && !pattern.startsWith("^(")) {
|
|
1122
|
+
nonCaptureGroup = true;
|
|
1123
|
+
parts.push("^(?:");
|
|
1124
|
+
}
|
|
1125
|
+
parts.push(this.mapRegexp(pattern));
|
|
1126
|
+
if (nonCaptureGroup && !pattern.endsWith("$") && !pattern.endsWith(")$")) {
|
|
1127
|
+
parts.push(")$");
|
|
1128
|
+
}
|
|
1129
|
+
return parts.join("");
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
// See https://datatracker.ietf.org/doc/html/rfc9485#name-ecmascript-regexps
|
|
1133
|
+
mapRegexp(pattern) {
|
|
1134
|
+
let escaped = false;
|
|
1135
|
+
let charClass = false;
|
|
1136
|
+
const parts = [];
|
|
1137
|
+
for (const ch of pattern) {
|
|
1138
|
+
switch (ch) {
|
|
1139
|
+
case ".":
|
|
1140
|
+
if (!escaped && !charClass) {
|
|
1141
|
+
parts.push("(?:(?![\r\n])\\P{Cs}|\\p{Cs}\\p{Cs})");
|
|
1142
|
+
} else {
|
|
1143
|
+
parts.push(ch);
|
|
1144
|
+
escaped = false;
|
|
1145
|
+
}
|
|
1146
|
+
break;
|
|
1147
|
+
case "\\":
|
|
1148
|
+
escaped = true;
|
|
1149
|
+
parts.push(ch);
|
|
1150
|
+
break;
|
|
1151
|
+
case "[":
|
|
1152
|
+
charClass = true;
|
|
1153
|
+
escaped = false;
|
|
1154
|
+
parts.push(ch);
|
|
1155
|
+
break;
|
|
1156
|
+
case "]":
|
|
1157
|
+
charClass = false;
|
|
1158
|
+
escaped = false;
|
|
1159
|
+
parts.push(ch);
|
|
1160
|
+
break;
|
|
1161
|
+
default:
|
|
1162
|
+
escaped = false;
|
|
1163
|
+
parts.push(ch);
|
|
1164
|
+
break;
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1123
1167
|
return parts.join("");
|
|
1124
1168
|
}
|
|
1125
1169
|
}
|
|
@@ -1148,7 +1192,7 @@ var json_p3 = (function (exports) {
|
|
|
1148
1192
|
}
|
|
1149
1193
|
}
|
|
1150
1194
|
try {
|
|
1151
|
-
const re = new RegExp(pattern, "u");
|
|
1195
|
+
const re = new RegExp(this.mapRegexp(pattern), "u");
|
|
1152
1196
|
if (this.cacheSize > 0) this.#cache.set(pattern, re);
|
|
1153
1197
|
return !!s.match(re);
|
|
1154
1198
|
} catch (error) {
|
|
@@ -1156,6 +1200,44 @@ var json_p3 = (function (exports) {
|
|
|
1156
1200
|
return false;
|
|
1157
1201
|
}
|
|
1158
1202
|
}
|
|
1203
|
+
|
|
1204
|
+
// See https://datatracker.ietf.org/doc/html/rfc9485#name-ecmascript-regexps
|
|
1205
|
+
mapRegexp(pattern) {
|
|
1206
|
+
let escaped = false;
|
|
1207
|
+
let charClass = false;
|
|
1208
|
+
const parts = [];
|
|
1209
|
+
for (const ch of pattern) {
|
|
1210
|
+
switch (ch) {
|
|
1211
|
+
case ".":
|
|
1212
|
+
if (!escaped && !charClass) {
|
|
1213
|
+
parts.push("(?:(?![\r\n])\\P{Cs}|\\p{Cs}\\p{Cs})");
|
|
1214
|
+
} else {
|
|
1215
|
+
parts.push(ch);
|
|
1216
|
+
escaped = false;
|
|
1217
|
+
}
|
|
1218
|
+
break;
|
|
1219
|
+
case "\\":
|
|
1220
|
+
escaped = true;
|
|
1221
|
+
parts.push(ch);
|
|
1222
|
+
break;
|
|
1223
|
+
case "[":
|
|
1224
|
+
charClass = true;
|
|
1225
|
+
escaped = false;
|
|
1226
|
+
parts.push(ch);
|
|
1227
|
+
break;
|
|
1228
|
+
case "]":
|
|
1229
|
+
charClass = false;
|
|
1230
|
+
escaped = false;
|
|
1231
|
+
parts.push(ch);
|
|
1232
|
+
break;
|
|
1233
|
+
default:
|
|
1234
|
+
escaped = false;
|
|
1235
|
+
parts.push(ch);
|
|
1236
|
+
break;
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
return parts.join("");
|
|
1240
|
+
}
|
|
1159
1241
|
}
|
|
1160
1242
|
|
|
1161
1243
|
class Value {
|
|
@@ -1570,6 +1652,7 @@ var json_p3 = (function (exports) {
|
|
|
1570
1652
|
continue;
|
|
1571
1653
|
}
|
|
1572
1654
|
if (!l.environment.strict && l.acceptMatchRun(l.environment.keysPattern)) {
|
|
1655
|
+
// FIXME: fall back to legacy behavior if keysPattern is not the default
|
|
1573
1656
|
switch (l.peek()) {
|
|
1574
1657
|
case "'":
|
|
1575
1658
|
l.ignore(); // ~
|
|
@@ -1580,7 +1663,6 @@ var json_p3 = (function (exports) {
|
|
|
1580
1663
|
l.next();
|
|
1581
1664
|
return lexDoubleQuoteKeyString(l);
|
|
1582
1665
|
case "?":
|
|
1583
|
-
l.ignore(); // ~
|
|
1584
1666
|
l.next();
|
|
1585
1667
|
l.emit(TokenKind.KEYS_FILTER);
|
|
1586
1668
|
l.filterLevel += 1;
|
|
@@ -3685,7 +3767,7 @@ var json_p3 = (function (exports) {
|
|
|
3685
3767
|
apply: apply
|
|
3686
3768
|
});
|
|
3687
3769
|
|
|
3688
|
-
const version = "1.3.
|
|
3770
|
+
const version = "1.3.1";
|
|
3689
3771
|
|
|
3690
3772
|
exports.DEFAULT_ENVIRONMENT = DEFAULT_ENVIRONMENT;
|
|
3691
3773
|
exports.FunctionExpressionType = FunctionExpressionType;
|