json-p3 1.3.4 → 1.3.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/json-p3.cjs.js +28 -17
- package/dist/json-p3.esm.js +28 -17
- package/dist/json-p3.iife.js +28 -17
- package/dist/json-p3.iife.min.js +1 -1
- package/dist/json-p3.iife.min.js.map +1 -1
- package/dist/path/lru_cache.d.ts +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +25 -25
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.5
|
|
3
3
|
* https://github.com/jg-rp/json-p3
|
|
4
4
|
*
|
|
5
5
|
* MIT License
|
|
@@ -1042,16 +1042,16 @@ var expression = /*#__PURE__*/Object.freeze({
|
|
|
1042
1042
|
});
|
|
1043
1043
|
|
|
1044
1044
|
class Count {
|
|
1045
|
-
argTypes = [FunctionExpressionType.NodesType];
|
|
1046
|
-
returnType = FunctionExpressionType.ValueType;
|
|
1045
|
+
argTypes = (() => [FunctionExpressionType.NodesType])();
|
|
1046
|
+
returnType = (() => FunctionExpressionType.ValueType)();
|
|
1047
1047
|
call(nodes) {
|
|
1048
1048
|
return nodes.length;
|
|
1049
1049
|
}
|
|
1050
1050
|
}
|
|
1051
1051
|
|
|
1052
1052
|
class Length {
|
|
1053
|
-
argTypes = [FunctionExpressionType.ValueType];
|
|
1054
|
-
returnType = FunctionExpressionType.ValueType;
|
|
1053
|
+
argTypes = (() => [FunctionExpressionType.ValueType])();
|
|
1054
|
+
returnType = (() => FunctionExpressionType.ValueType)();
|
|
1055
1055
|
call(value) {
|
|
1056
1056
|
if (isArray(value) || isString(value)) return value.length;
|
|
1057
1057
|
if (isObject(value)) return Object.keys(value).length;
|
|
@@ -1085,7 +1085,10 @@ class LRUCache extends Map {
|
|
|
1085
1085
|
if (this.has(key)) {
|
|
1086
1086
|
this.delete(key);
|
|
1087
1087
|
} else if (this.size >= this.maxSize) {
|
|
1088
|
-
this.
|
|
1088
|
+
const first = this.first();
|
|
1089
|
+
if (first !== undefined) {
|
|
1090
|
+
this.delete(first);
|
|
1091
|
+
}
|
|
1089
1092
|
}
|
|
1090
1093
|
return super.set(key, value);
|
|
1091
1094
|
}
|
|
@@ -2344,8 +2347,8 @@ var check_1 = {
|
|
|
2344
2347
|
var check$1 = check_1.check;
|
|
2345
2348
|
|
|
2346
2349
|
class Match {
|
|
2347
|
-
argTypes = [FunctionExpressionType.ValueType, FunctionExpressionType.ValueType];
|
|
2348
|
-
returnType = FunctionExpressionType.LogicalType;
|
|
2350
|
+
argTypes = (() => [FunctionExpressionType.ValueType, FunctionExpressionType.ValueType])();
|
|
2351
|
+
returnType = (() => FunctionExpressionType.LogicalType)();
|
|
2349
2352
|
#cache;
|
|
2350
2353
|
constructor() {
|
|
2351
2354
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -2402,8 +2405,8 @@ class Match {
|
|
|
2402
2405
|
}
|
|
2403
2406
|
|
|
2404
2407
|
class Search {
|
|
2405
|
-
argTypes = [FunctionExpressionType.ValueType, FunctionExpressionType.ValueType];
|
|
2406
|
-
returnType = FunctionExpressionType.LogicalType;
|
|
2408
|
+
argTypes = (() => [FunctionExpressionType.ValueType, FunctionExpressionType.ValueType])();
|
|
2409
|
+
returnType = (() => FunctionExpressionType.LogicalType)();
|
|
2407
2410
|
#cache;
|
|
2408
2411
|
constructor() {
|
|
2409
2412
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -2451,8 +2454,8 @@ class Search {
|
|
|
2451
2454
|
}
|
|
2452
2455
|
|
|
2453
2456
|
class Value {
|
|
2454
|
-
argTypes = [FunctionExpressionType.NodesType];
|
|
2455
|
-
returnType = FunctionExpressionType.ValueType;
|
|
2457
|
+
argTypes = (() => [FunctionExpressionType.NodesType])();
|
|
2458
|
+
returnType = (() => FunctionExpressionType.ValueType)();
|
|
2456
2459
|
call(nodes) {
|
|
2457
2460
|
if (nodes.length === 1) return nodes.nodes[0].value;
|
|
2458
2461
|
return Nothing;
|
|
@@ -4419,7 +4422,7 @@ class JSONPathEnvironment {
|
|
|
4419
4422
|
* A map of function names to objects implementing the {@link FilterFunction}
|
|
4420
4423
|
* interface. You are free to set or delete custom filter functions directly.
|
|
4421
4424
|
*/
|
|
4422
|
-
functionRegister = new Map();
|
|
4425
|
+
functionRegister = (() => new Map())();
|
|
4423
4426
|
/**
|
|
4424
4427
|
* @param options - Environment configuration options.
|
|
4425
4428
|
*/
|
|
@@ -4862,7 +4865,11 @@ class OpMove {
|
|
|
4862
4865
|
throw new JSONPatchError(`unexpected operation on 'undefined' (${this.name}:${index})`);
|
|
4863
4866
|
}
|
|
4864
4867
|
if (isArray(destParent)) {
|
|
4865
|
-
|
|
4868
|
+
if (destTarget === "-") {
|
|
4869
|
+
destParent.push(sourceObj);
|
|
4870
|
+
} else {
|
|
4871
|
+
destParent.splice(Number(destTarget), 0, sourceObj);
|
|
4872
|
+
}
|
|
4866
4873
|
} else if (isObject(destParent)) {
|
|
4867
4874
|
destParent[destTarget] = sourceObj;
|
|
4868
4875
|
} else {
|
|
@@ -4904,11 +4911,15 @@ class OpCopy {
|
|
|
4904
4911
|
throw new JSONPatchError(`unexpected operation on 'undefined' (${this.name}:${index})`);
|
|
4905
4912
|
}
|
|
4906
4913
|
if (isArray(destParent)) {
|
|
4907
|
-
|
|
4914
|
+
if (destTarget === "-") {
|
|
4915
|
+
destParent.push(this.deepCopy(sourceObj));
|
|
4916
|
+
} else {
|
|
4917
|
+
destParent.splice(Number(destTarget), 0, this.deepCopy(sourceObj));
|
|
4918
|
+
}
|
|
4908
4919
|
} else if (isObject(destParent)) {
|
|
4909
4920
|
destParent[destTarget] = this.deepCopy(sourceObj);
|
|
4910
4921
|
} else {
|
|
4911
|
-
throw new JSONPatchError(`unexpected operation on '${typeof
|
|
4922
|
+
throw new JSONPatchError(`unexpected operation on '${typeof destParent}' (${this.name}:${index})`);
|
|
4912
4923
|
}
|
|
4913
4924
|
return value;
|
|
4914
4925
|
}
|
|
@@ -5151,7 +5162,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
5151
5162
|
apply: apply
|
|
5152
5163
|
});
|
|
5153
5164
|
|
|
5154
|
-
const version = "1.3.
|
|
5165
|
+
const version = "1.3.5";
|
|
5155
5166
|
|
|
5156
5167
|
exports.DEFAULT_ENVIRONMENT = DEFAULT_ENVIRONMENT;
|
|
5157
5168
|
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.5
|
|
3
3
|
* https://github.com/jg-rp/json-p3
|
|
4
4
|
*
|
|
5
5
|
* MIT License
|
|
@@ -1040,16 +1040,16 @@ var expression = /*#__PURE__*/Object.freeze({
|
|
|
1040
1040
|
});
|
|
1041
1041
|
|
|
1042
1042
|
class Count {
|
|
1043
|
-
argTypes = [FunctionExpressionType.NodesType];
|
|
1044
|
-
returnType = FunctionExpressionType.ValueType;
|
|
1043
|
+
argTypes = (() => [FunctionExpressionType.NodesType])();
|
|
1044
|
+
returnType = (() => FunctionExpressionType.ValueType)();
|
|
1045
1045
|
call(nodes) {
|
|
1046
1046
|
return nodes.length;
|
|
1047
1047
|
}
|
|
1048
1048
|
}
|
|
1049
1049
|
|
|
1050
1050
|
class Length {
|
|
1051
|
-
argTypes = [FunctionExpressionType.ValueType];
|
|
1052
|
-
returnType = FunctionExpressionType.ValueType;
|
|
1051
|
+
argTypes = (() => [FunctionExpressionType.ValueType])();
|
|
1052
|
+
returnType = (() => FunctionExpressionType.ValueType)();
|
|
1053
1053
|
call(value) {
|
|
1054
1054
|
if (isArray(value) || isString(value)) return value.length;
|
|
1055
1055
|
if (isObject(value)) return Object.keys(value).length;
|
|
@@ -1083,7 +1083,10 @@ class LRUCache extends Map {
|
|
|
1083
1083
|
if (this.has(key)) {
|
|
1084
1084
|
this.delete(key);
|
|
1085
1085
|
} else if (this.size >= this.maxSize) {
|
|
1086
|
-
this.
|
|
1086
|
+
const first = this.first();
|
|
1087
|
+
if (first !== undefined) {
|
|
1088
|
+
this.delete(first);
|
|
1089
|
+
}
|
|
1087
1090
|
}
|
|
1088
1091
|
return super.set(key, value);
|
|
1089
1092
|
}
|
|
@@ -2342,8 +2345,8 @@ var check_1 = {
|
|
|
2342
2345
|
var check$1 = check_1.check;
|
|
2343
2346
|
|
|
2344
2347
|
class Match {
|
|
2345
|
-
argTypes = [FunctionExpressionType.ValueType, FunctionExpressionType.ValueType];
|
|
2346
|
-
returnType = FunctionExpressionType.LogicalType;
|
|
2348
|
+
argTypes = (() => [FunctionExpressionType.ValueType, FunctionExpressionType.ValueType])();
|
|
2349
|
+
returnType = (() => FunctionExpressionType.LogicalType)();
|
|
2347
2350
|
#cache;
|
|
2348
2351
|
constructor() {
|
|
2349
2352
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -2400,8 +2403,8 @@ class Match {
|
|
|
2400
2403
|
}
|
|
2401
2404
|
|
|
2402
2405
|
class Search {
|
|
2403
|
-
argTypes = [FunctionExpressionType.ValueType, FunctionExpressionType.ValueType];
|
|
2404
|
-
returnType = FunctionExpressionType.LogicalType;
|
|
2406
|
+
argTypes = (() => [FunctionExpressionType.ValueType, FunctionExpressionType.ValueType])();
|
|
2407
|
+
returnType = (() => FunctionExpressionType.LogicalType)();
|
|
2405
2408
|
#cache;
|
|
2406
2409
|
constructor() {
|
|
2407
2410
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -2449,8 +2452,8 @@ class Search {
|
|
|
2449
2452
|
}
|
|
2450
2453
|
|
|
2451
2454
|
class Value {
|
|
2452
|
-
argTypes = [FunctionExpressionType.NodesType];
|
|
2453
|
-
returnType = FunctionExpressionType.ValueType;
|
|
2455
|
+
argTypes = (() => [FunctionExpressionType.NodesType])();
|
|
2456
|
+
returnType = (() => FunctionExpressionType.ValueType)();
|
|
2454
2457
|
call(nodes) {
|
|
2455
2458
|
if (nodes.length === 1) return nodes.nodes[0].value;
|
|
2456
2459
|
return Nothing;
|
|
@@ -4417,7 +4420,7 @@ class JSONPathEnvironment {
|
|
|
4417
4420
|
* A map of function names to objects implementing the {@link FilterFunction}
|
|
4418
4421
|
* interface. You are free to set or delete custom filter functions directly.
|
|
4419
4422
|
*/
|
|
4420
|
-
functionRegister = new Map();
|
|
4423
|
+
functionRegister = (() => new Map())();
|
|
4421
4424
|
/**
|
|
4422
4425
|
* @param options - Environment configuration options.
|
|
4423
4426
|
*/
|
|
@@ -4860,7 +4863,11 @@ class OpMove {
|
|
|
4860
4863
|
throw new JSONPatchError(`unexpected operation on 'undefined' (${this.name}:${index})`);
|
|
4861
4864
|
}
|
|
4862
4865
|
if (isArray(destParent)) {
|
|
4863
|
-
|
|
4866
|
+
if (destTarget === "-") {
|
|
4867
|
+
destParent.push(sourceObj);
|
|
4868
|
+
} else {
|
|
4869
|
+
destParent.splice(Number(destTarget), 0, sourceObj);
|
|
4870
|
+
}
|
|
4864
4871
|
} else if (isObject(destParent)) {
|
|
4865
4872
|
destParent[destTarget] = sourceObj;
|
|
4866
4873
|
} else {
|
|
@@ -4902,11 +4909,15 @@ class OpCopy {
|
|
|
4902
4909
|
throw new JSONPatchError(`unexpected operation on 'undefined' (${this.name}:${index})`);
|
|
4903
4910
|
}
|
|
4904
4911
|
if (isArray(destParent)) {
|
|
4905
|
-
|
|
4912
|
+
if (destTarget === "-") {
|
|
4913
|
+
destParent.push(this.deepCopy(sourceObj));
|
|
4914
|
+
} else {
|
|
4915
|
+
destParent.splice(Number(destTarget), 0, this.deepCopy(sourceObj));
|
|
4916
|
+
}
|
|
4906
4917
|
} else if (isObject(destParent)) {
|
|
4907
4918
|
destParent[destTarget] = this.deepCopy(sourceObj);
|
|
4908
4919
|
} else {
|
|
4909
|
-
throw new JSONPatchError(`unexpected operation on '${typeof
|
|
4920
|
+
throw new JSONPatchError(`unexpected operation on '${typeof destParent}' (${this.name}:${index})`);
|
|
4910
4921
|
}
|
|
4911
4922
|
return value;
|
|
4912
4923
|
}
|
|
@@ -5149,6 +5160,6 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
5149
5160
|
apply: apply
|
|
5150
5161
|
});
|
|
5151
5162
|
|
|
5152
|
-
const version = "1.3.
|
|
5163
|
+
const version = "1.3.5";
|
|
5153
5164
|
|
|
5154
5165
|
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.5
|
|
3
3
|
* https://github.com/jg-rp/json-p3
|
|
4
4
|
*
|
|
5
5
|
* MIT License
|
|
@@ -1043,16 +1043,16 @@ var json_p3 = (function (exports) {
|
|
|
1043
1043
|
});
|
|
1044
1044
|
|
|
1045
1045
|
class Count {
|
|
1046
|
-
argTypes = [FunctionExpressionType.NodesType];
|
|
1047
|
-
returnType = FunctionExpressionType.ValueType;
|
|
1046
|
+
argTypes = (() => [FunctionExpressionType.NodesType])();
|
|
1047
|
+
returnType = (() => FunctionExpressionType.ValueType)();
|
|
1048
1048
|
call(nodes) {
|
|
1049
1049
|
return nodes.length;
|
|
1050
1050
|
}
|
|
1051
1051
|
}
|
|
1052
1052
|
|
|
1053
1053
|
class Length {
|
|
1054
|
-
argTypes = [FunctionExpressionType.ValueType];
|
|
1055
|
-
returnType = FunctionExpressionType.ValueType;
|
|
1054
|
+
argTypes = (() => [FunctionExpressionType.ValueType])();
|
|
1055
|
+
returnType = (() => FunctionExpressionType.ValueType)();
|
|
1056
1056
|
call(value) {
|
|
1057
1057
|
if (isArray(value) || isString(value)) return value.length;
|
|
1058
1058
|
if (isObject(value)) return Object.keys(value).length;
|
|
@@ -1086,7 +1086,10 @@ var json_p3 = (function (exports) {
|
|
|
1086
1086
|
if (this.has(key)) {
|
|
1087
1087
|
this.delete(key);
|
|
1088
1088
|
} else if (this.size >= this.maxSize) {
|
|
1089
|
-
this.
|
|
1089
|
+
const first = this.first();
|
|
1090
|
+
if (first !== undefined) {
|
|
1091
|
+
this.delete(first);
|
|
1092
|
+
}
|
|
1090
1093
|
}
|
|
1091
1094
|
return super.set(key, value);
|
|
1092
1095
|
}
|
|
@@ -2345,8 +2348,8 @@ var json_p3 = (function (exports) {
|
|
|
2345
2348
|
var check$1 = check_1.check;
|
|
2346
2349
|
|
|
2347
2350
|
class Match {
|
|
2348
|
-
argTypes = [FunctionExpressionType.ValueType, FunctionExpressionType.ValueType];
|
|
2349
|
-
returnType = FunctionExpressionType.LogicalType;
|
|
2351
|
+
argTypes = (() => [FunctionExpressionType.ValueType, FunctionExpressionType.ValueType])();
|
|
2352
|
+
returnType = (() => FunctionExpressionType.LogicalType)();
|
|
2350
2353
|
#cache;
|
|
2351
2354
|
constructor() {
|
|
2352
2355
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -2403,8 +2406,8 @@ var json_p3 = (function (exports) {
|
|
|
2403
2406
|
}
|
|
2404
2407
|
|
|
2405
2408
|
class Search {
|
|
2406
|
-
argTypes = [FunctionExpressionType.ValueType, FunctionExpressionType.ValueType];
|
|
2407
|
-
returnType = FunctionExpressionType.LogicalType;
|
|
2409
|
+
argTypes = (() => [FunctionExpressionType.ValueType, FunctionExpressionType.ValueType])();
|
|
2410
|
+
returnType = (() => FunctionExpressionType.LogicalType)();
|
|
2408
2411
|
#cache;
|
|
2409
2412
|
constructor() {
|
|
2410
2413
|
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -2452,8 +2455,8 @@ var json_p3 = (function (exports) {
|
|
|
2452
2455
|
}
|
|
2453
2456
|
|
|
2454
2457
|
class Value {
|
|
2455
|
-
argTypes = [FunctionExpressionType.NodesType];
|
|
2456
|
-
returnType = FunctionExpressionType.ValueType;
|
|
2458
|
+
argTypes = (() => [FunctionExpressionType.NodesType])();
|
|
2459
|
+
returnType = (() => FunctionExpressionType.ValueType)();
|
|
2457
2460
|
call(nodes) {
|
|
2458
2461
|
if (nodes.length === 1) return nodes.nodes[0].value;
|
|
2459
2462
|
return Nothing;
|
|
@@ -4420,7 +4423,7 @@ var json_p3 = (function (exports) {
|
|
|
4420
4423
|
* A map of function names to objects implementing the {@link FilterFunction}
|
|
4421
4424
|
* interface. You are free to set or delete custom filter functions directly.
|
|
4422
4425
|
*/
|
|
4423
|
-
functionRegister = new Map();
|
|
4426
|
+
functionRegister = (() => new Map())();
|
|
4424
4427
|
/**
|
|
4425
4428
|
* @param options - Environment configuration options.
|
|
4426
4429
|
*/
|
|
@@ -4863,7 +4866,11 @@ var json_p3 = (function (exports) {
|
|
|
4863
4866
|
throw new JSONPatchError(`unexpected operation on 'undefined' (${this.name}:${index})`);
|
|
4864
4867
|
}
|
|
4865
4868
|
if (isArray(destParent)) {
|
|
4866
|
-
|
|
4869
|
+
if (destTarget === "-") {
|
|
4870
|
+
destParent.push(sourceObj);
|
|
4871
|
+
} else {
|
|
4872
|
+
destParent.splice(Number(destTarget), 0, sourceObj);
|
|
4873
|
+
}
|
|
4867
4874
|
} else if (isObject(destParent)) {
|
|
4868
4875
|
destParent[destTarget] = sourceObj;
|
|
4869
4876
|
} else {
|
|
@@ -4905,11 +4912,15 @@ var json_p3 = (function (exports) {
|
|
|
4905
4912
|
throw new JSONPatchError(`unexpected operation on 'undefined' (${this.name}:${index})`);
|
|
4906
4913
|
}
|
|
4907
4914
|
if (isArray(destParent)) {
|
|
4908
|
-
|
|
4915
|
+
if (destTarget === "-") {
|
|
4916
|
+
destParent.push(this.deepCopy(sourceObj));
|
|
4917
|
+
} else {
|
|
4918
|
+
destParent.splice(Number(destTarget), 0, this.deepCopy(sourceObj));
|
|
4919
|
+
}
|
|
4909
4920
|
} else if (isObject(destParent)) {
|
|
4910
4921
|
destParent[destTarget] = this.deepCopy(sourceObj);
|
|
4911
4922
|
} else {
|
|
4912
|
-
throw new JSONPatchError(`unexpected operation on '${typeof
|
|
4923
|
+
throw new JSONPatchError(`unexpected operation on '${typeof destParent}' (${this.name}:${index})`);
|
|
4913
4924
|
}
|
|
4914
4925
|
return value;
|
|
4915
4926
|
}
|
|
@@ -5152,7 +5163,7 @@ var json_p3 = (function (exports) {
|
|
|
5152
5163
|
apply: apply
|
|
5153
5164
|
});
|
|
5154
5165
|
|
|
5155
|
-
const version = "1.3.
|
|
5166
|
+
const version = "1.3.5";
|
|
5156
5167
|
|
|
5157
5168
|
exports.DEFAULT_ENVIRONMENT = DEFAULT_ENVIRONMENT;
|
|
5158
5169
|
exports.FunctionExpressionType = FunctionExpressionType;
|