ast-deep-contains 4.0.2 → 4.0.6
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/CHANGELOG.md +0 -6
- package/LICENSE +1 -1
- package/dist/ast-deep-contains.esm.js +93 -85
- package/dist/ast-deep-contains.umd.js +4 -4
- package/package.json +39 -43
package/CHANGELOG.md
CHANGED
|
@@ -3,12 +3,6 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## 4.0.1 (2021-09-13)
|
|
7
|
-
|
|
8
|
-
### Bug Fixes
|
|
9
|
-
|
|
10
|
-
- bump TS and separate ESLint plugins away from this monorepo ([2e07d42](https://github.com/codsen/codsen/commit/2e07d424222b6ffedf5fb45c83ad453627ec2904))
|
|
11
|
-
|
|
12
6
|
## 4.0.0 (2021-09-09)
|
|
13
7
|
|
|
14
8
|
### Features
|
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2010
|
|
3
|
+
Copyright (c) 2010-2021 Roy Revelt and other contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
a copy of this software and associated documentation files (the
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name ast-deep-contains
|
|
3
3
|
* @fileoverview Like t.same assert on array of objects, where element order doesn't matter.
|
|
4
|
-
* @version 4.0.
|
|
4
|
+
* @version 4.0.6
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/ast-deep-contains/}
|
|
@@ -11,104 +11,112 @@ import objectPath from 'object-path';
|
|
|
11
11
|
import { traverse } from 'ast-monkey-traverse';
|
|
12
12
|
import is from '@sindresorhus/is';
|
|
13
13
|
|
|
14
|
-
var version$1 = "4.0.
|
|
14
|
+
var version$1 = "4.0.6";
|
|
15
15
|
|
|
16
16
|
const version = version$1;
|
|
17
17
|
function goUp(pathStr) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
if (pathStr.includes(".")) {
|
|
19
|
+
for (let i = pathStr.length; i--;) {
|
|
20
|
+
if (pathStr[i] === ".") {
|
|
21
|
+
return pathStr.slice(0, i);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
-
return pathStr;
|
|
25
|
+
return pathStr;
|
|
26
26
|
}
|
|
27
27
|
function dropIth(arr, badIdx) {
|
|
28
|
-
|
|
28
|
+
return Array.from(arr).filter((_el, i) => i !== badIdx);
|
|
29
29
|
}
|
|
30
30
|
const defaults = {
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
skipContainers: true,
|
|
32
|
+
arrayStrictComparison: false,
|
|
33
33
|
};
|
|
34
34
|
function deepContains(tree1, tree2, cb, errCb, originalOpts) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
35
|
+
const opts = { ...defaults, ...originalOpts };
|
|
36
|
+
if (is(tree1) !== is(tree2)) {
|
|
37
|
+
errCb(`the first input arg is of a type ${is(tree1).toLowerCase()} but the second is ${is(tree2).toLowerCase()}. Values are - 1st:\n${JSON.stringify(tree1, null, 4)}\n2nd:\n${JSON.stringify(tree2, null, 4)}`);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
traverse(tree2, (key, val, innerObj, stop) => {
|
|
41
|
+
const current = val !== undefined ? val : key;
|
|
42
|
+
const { path } = innerObj;
|
|
43
|
+
if (objectPath.has(tree1, path)) {
|
|
44
|
+
if (!opts.arrayStrictComparison &&
|
|
45
|
+
is.plainObject(current) &&
|
|
46
|
+
innerObj.parentType === "array" &&
|
|
47
|
+
innerObj.parent.length > 1) {
|
|
48
|
+
stop.now = true;
|
|
49
|
+
const arr1 = Array.from(innerObj.path.includes(".")
|
|
50
|
+
? objectPath.get(tree1, goUp(path))
|
|
51
|
+
: tree1);
|
|
52
|
+
if (arr1.length < innerObj.parent.length) {
|
|
53
|
+
errCb(`the first array: ${JSON.stringify(arr1, null, 4)}\nhas less objects than array we're matching against, ${JSON.stringify(innerObj.parent, null, 4)}`);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
const arr2 = innerObj.parent;
|
|
57
|
+
const tree1RefSource = arr1.map((_v, i) => i);
|
|
58
|
+
arr2.map((_v, i) => i);
|
|
59
|
+
const secondDigits = [];
|
|
60
|
+
for (let i = 0, len = tree1RefSource.length; i < len; i++) {
|
|
61
|
+
const currArr = [];
|
|
62
|
+
const pickedVal = tree1RefSource[i];
|
|
63
|
+
const disposableArr1 = dropIth(tree1RefSource, i);
|
|
64
|
+
currArr.push(pickedVal);
|
|
65
|
+
disposableArr1.forEach((key1) => {
|
|
66
|
+
secondDigits.push(Array.from(currArr).concat(key1));
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
const finalCombined = secondDigits.map((arr) => {
|
|
70
|
+
return arr.map((val2, i) => [i, val2]);
|
|
71
|
+
});
|
|
72
|
+
let maxScore = 0;
|
|
73
|
+
for (let i = 0, len = finalCombined.length; i < len; i++) {
|
|
74
|
+
let score = 0;
|
|
75
|
+
finalCombined[i].forEach((mapping) => {
|
|
76
|
+
if (is.plainObject(arr2[mapping[0]]) &&
|
|
77
|
+
is.plainObject(arr1[mapping[1]])) {
|
|
78
|
+
Object.keys(arr2[mapping[0]]).forEach((key2) => {
|
|
79
|
+
if (Object.keys(arr1[mapping[1]]).includes(key2)) {
|
|
80
|
+
score += 1;
|
|
81
|
+
if (arr1[mapping[1]][key2] ===
|
|
82
|
+
arr2[mapping[0]][key2]) {
|
|
83
|
+
score += 5;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
finalCombined[i].push(score);
|
|
90
|
+
if (score > maxScore) {
|
|
91
|
+
maxScore = score;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
for (let i = 0, len = finalCombined.length; i < len; i++) {
|
|
95
|
+
if (finalCombined[i][2] === maxScore) {
|
|
96
|
+
finalCombined[i].forEach((matchPairObj, y) => {
|
|
97
|
+
if (y < finalCombined[i].length - 1) {
|
|
98
|
+
deepContains(arr1[matchPairObj[1]], arr2[matchPairObj[0]], cb, errCb, opts);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
const retrieved = objectPath.get(tree1, path);
|
|
108
|
+
if (!opts.skipContainers ||
|
|
109
|
+
(!is.plainObject(retrieved) && !Array.isArray(retrieved))) {
|
|
110
|
+
cb(retrieved, current, path);
|
|
80
111
|
}
|
|
81
|
-
});
|
|
82
112
|
}
|
|
83
|
-
});
|
|
84
|
-
finalCombined[i].push(score);
|
|
85
|
-
if (score > maxScore) {
|
|
86
|
-
maxScore = score;
|
|
87
|
-
}
|
|
88
113
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
finalCombined[i].forEach((matchPairObj, y) => {
|
|
92
|
-
if (y < finalCombined[i].length - 1) {
|
|
93
|
-
deepContains(arr1[matchPairObj[1]], arr2[matchPairObj[0]], cb, errCb, opts);
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
114
|
+
else {
|
|
115
|
+
errCb(`the first input: ${JSON.stringify(tree1, null, 4)}\ndoes not have the path "${path}", we were looking, would it contain a value ${JSON.stringify(current, null, 0)}.`);
|
|
98
116
|
}
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (!opts.skipContainers || !is.plainObject(retrieved) && !Array.isArray(retrieved)) {
|
|
103
|
-
cb(retrieved, current, path);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
} else {
|
|
107
|
-
errCb(`the first input: ${JSON.stringify(tree1, null, 4)}\ndoes not have the path "${path}", we were looking, would it contain a value ${JSON.stringify(current, null, 0)}.`);
|
|
108
|
-
}
|
|
109
|
-
return current;
|
|
110
|
-
});
|
|
111
|
-
}
|
|
117
|
+
return current;
|
|
118
|
+
});
|
|
119
|
+
}
|
|
112
120
|
}
|
|
113
121
|
|
|
114
122
|
export { deepContains, defaults, version };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @name ast-deep-contains
|
|
3
3
|
* @fileoverview Like t.same assert on array of objects, where element order doesn't matter.
|
|
4
|
-
* @version 4.0.
|
|
4
|
+
* @version 4.0.6
|
|
5
5
|
* @author Roy Revelt, Codsen Ltd
|
|
6
6
|
* @license MIT
|
|
7
7
|
* {@link https://codsen.com/os/ast-deep-contains/}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
/**
|
|
12
12
|
* @name ast-monkey-util
|
|
13
13
|
* @fileoverview Utility library of AST helper functions
|
|
14
|
-
* @version 2.0.
|
|
14
|
+
* @version 2.0.6
|
|
15
15
|
* @author Roy Revelt, Codsen Ltd
|
|
16
16
|
* @license MIT
|
|
17
17
|
* {@link https://codsen.com/os/ast-monkey-util/}
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
/**
|
|
20
20
|
* @name ast-monkey-traverse
|
|
21
21
|
* @fileoverview Utility library to traverse AST
|
|
22
|
-
* @version 3.0.
|
|
22
|
+
* @version 3.0.6
|
|
23
23
|
* @author Roy Revelt, Codsen Ltd
|
|
24
24
|
* @license MIT
|
|
25
25
|
* {@link https://codsen.com/os/ast-monkey-traverse/}
|
|
26
|
-
*/var h={exports:{}};!function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const r=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];const n=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","FormData","URLSearchParams","HTMLElement",...r];const a=["null","undefined","string","number","bigint","boolean","symbol"];function o(t){return e=>typeof e===t}const{toString:i}=Object.prototype,u=t=>{const e=i.call(t).slice(8,-1);return/HTML\w+Element/.test(e)&&s.domElement(t)?"HTMLElement":n.includes(e)?e:void 0},c=t=>e=>u(e)===t;function s(t){if(null===t)return"null";switch(typeof t){case"undefined":return"undefined";case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"function":return"Function";case"bigint":return"bigint";case"symbol":return"symbol"}if(s.observable(t))return"Observable";if(s.array(t))return"Array";if(s.buffer(t))return"Buffer";const e=u(t);if(e)return e;if(t instanceof String||t instanceof Boolean||t instanceof Number)throw new TypeError("Please don't use object wrappers for primitive types");return"Object"}s.undefined=o("undefined"),s.string=o("string");const l=o("number");s.number=t=>l(t)&&!s.nan(t),s.bigint=o("bigint"),s.function_=o("function"),s.null_=t=>null===t,s.class_=t=>s.function_(t)&&t.toString().startsWith("class "),s.boolean=t=>!0===t||!1===t,s.symbol=o("symbol"),s.numericString=t=>s.string(t)&&!s.emptyStringOrWhitespace(t)&&!Number.isNaN(Number(t)),s.array=(t,e)=>!!Array.isArray(t)&&(!s.function_(e)||t.every(e)),s.buffer=t=>{var e,r,n,a;return null!==(a=null===(n=null===(r=null===(e=t)||void 0===e?void 0:e.constructor)||void 0===r?void 0:r.isBuffer)||void 0===n?void 0:n.call(r,t))&&void 0!==a&&a},s.nullOrUndefined=t=>s.null_(t)||s.undefined(t),s.object=t=>!s.null_(t)&&("object"==typeof t||s.function_(t)),s.iterable=t=>{var e;return s.function_(null===(e=t)||void 0===e?void 0:e[Symbol.iterator])},s.asyncIterable=t=>{var e;return s.function_(null===(e=t)||void 0===e?void 0:e[Symbol.asyncIterator])},s.generator=t=>s.iterable(t)&&s.function_(t.next)&&s.function_(t.throw),s.asyncGenerator=t=>s.asyncIterable(t)&&s.function_(t.next)&&s.function_(t.throw),s.nativePromise=t=>c("Promise")(t);s.promise=t=>s.nativePromise(t)||(t=>{var e,r;return s.function_(null===(e=t)||void 0===e?void 0:e.then)&&s.function_(null===(r=t)||void 0===r?void 0:r.catch)})(t),s.generatorFunction=c("GeneratorFunction"),s.asyncGeneratorFunction=t=>"AsyncGeneratorFunction"===u(t),s.asyncFunction=t=>"AsyncFunction"===u(t),s.boundFunction=t=>s.function_(t)&&!t.hasOwnProperty("prototype"),s.regExp=c("RegExp"),s.date=c("Date"),s.error=c("Error"),s.map=t=>c("Map")(t),s.set=t=>c("Set")(t),s.weakMap=t=>c("WeakMap")(t),s.weakSet=t=>c("WeakSet")(t),s.int8Array=c("Int8Array"),s.uint8Array=c("Uint8Array"),s.uint8ClampedArray=c("Uint8ClampedArray"),s.int16Array=c("Int16Array"),s.uint16Array=c("Uint16Array"),s.int32Array=c("Int32Array"),s.uint32Array=c("Uint32Array"),s.float32Array=c("Float32Array"),s.float64Array=c("Float64Array"),s.bigInt64Array=c("BigInt64Array"),s.bigUint64Array=c("BigUint64Array"),s.arrayBuffer=c("ArrayBuffer"),s.sharedArrayBuffer=c("SharedArrayBuffer"),s.dataView=c("DataView"),s.directInstanceOf=(t,e)=>Object.getPrototypeOf(t)===e.prototype,s.urlInstance=t=>c("URL")(t),s.urlString=t=>{if(!s.string(t))return!1;try{return new URL(t),!0}catch(t){return!1}},s.truthy=t=>Boolean(t),s.falsy=t=>!t,s.nan=t=>Number.isNaN(t),s.primitive=t=>s.null_(t)||a.includes(typeof t),s.integer=t=>Number.isInteger(t),s.safeInteger=t=>Number.isSafeInteger(t),s.plainObject=t=>{if("[object Object]"!==i.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.getPrototypeOf({})},s.typedArray=t=>{return e=u(t),r.includes(e);var e};s.arrayLike=t=>!s.nullOrUndefined(t)&&!s.function_(t)&&(t=>s.safeInteger(t)&&t>=0)(t.length),s.inRange=(t,e)=>{if(s.number(e))return t>=Math.min(0,e)&&t<=Math.max(e,0);if(s.array(e)&&2===e.length)return t>=Math.min(...e)&&t<=Math.max(...e);throw new TypeError(`Invalid range: ${JSON.stringify(e)}`)};const f=["innerHTML","ownerDocument","style","attributes","nodeValue"];s.domElement=t=>s.object(t)&&1===t.nodeType&&s.string(t.nodeName)&&!s.plainObject(t)&&f.every((e=>e in t)),s.observable=t=>{var e,r,n,a;return!!t&&(t===(null===(r=(e=t)[Symbol.observable])||void 0===r?void 0:r.call(e))||t===(null===(a=(n=t)["@@observable"])||void 0===a?void 0:a.call(n)))},s.nodeStream=t=>s.object(t)&&s.function_(t.pipe)&&!s.observable(t),s.infinite=t=>t===1/0||t===-1/0;const y=t=>e=>s.integer(e)&&Math.abs(e%2)===t;s.evenInteger=y(0),s.oddInteger=y(1),s.emptyArray=t=>s.array(t)&&0===t.length,s.nonEmptyArray=t=>s.array(t)&&t.length>0,s.emptyString=t=>s.string(t)&&0===t.length,s.nonEmptyString=t=>s.string(t)&&t.length>0;s.emptyStringOrWhitespace=t=>s.emptyString(t)||(t=>s.string(t)&&!/\S/.test(t))(t),s.emptyObject=t=>s.object(t)&&!s.map(t)&&!s.set(t)&&0===Object.keys(t).length,s.nonEmptyObject=t=>s.object(t)&&!s.map(t)&&!s.set(t)&&Object.keys(t).length>0,s.emptySet=t=>s.set(t)&&0===t.size,s.nonEmptySet=t=>s.set(t)&&t.size>0,s.emptyMap=t=>s.map(t)&&0===t.size,s.nonEmptyMap=t=>s.map(t)&&t.size>0,s.propertyKey=t=>s.any([s.string,s.number,s.symbol],t),s.formData=t=>c("FormData")(t),s.urlSearchParams=t=>c("URLSearchParams")(t);const p=(t,e,r)=>{if(!s.function_(e))throw new TypeError(`Invalid predicate: ${JSON.stringify(e)}`);if(0===r.length)throw new TypeError("Invalid number of values");return t.call(r,e)};s.any=(t,...e)=>(s.array(t)?t:[t]).some((t=>p(Array.prototype.some,t,e))),s.all=(t,...e)=>p(Array.prototype.every,t,e);const b=(t,e,r,n={})=>{if(!t){const{multipleValues:t}=n,a=t?`received values of types ${[...new Set(r.map((t=>`\`${s(t)}\``)))].join(", ")}`:`received value of type \`${s(r)}\``;throw new TypeError(`Expected value which is \`${e}\`, ${a}.`)}};e.assert={undefined:t=>b(s.undefined(t),"undefined",t),string:t=>b(s.string(t),"string",t),number:t=>b(s.number(t),"number",t),bigint:t=>b(s.bigint(t),"bigint",t),function_:t=>b(s.function_(t),"Function",t),null_:t=>b(s.null_(t),"null",t),class_:t=>b(s.class_(t),"Class",t),boolean:t=>b(s.boolean(t),"boolean",t),symbol:t=>b(s.symbol(t),"symbol",t),numericString:t=>b(s.numericString(t),"string with a number",t),array:(t,e)=>{b(s.array(t),"Array",t),e&&t.forEach(e)},buffer:t=>b(s.buffer(t),"Buffer",t),nullOrUndefined:t=>b(s.nullOrUndefined(t),"null or undefined",t),object:t=>b(s.object(t),"Object",t),iterable:t=>b(s.iterable(t),"Iterable",t),asyncIterable:t=>b(s.asyncIterable(t),"AsyncIterable",t),generator:t=>b(s.generator(t),"Generator",t),asyncGenerator:t=>b(s.asyncGenerator(t),"AsyncGenerator",t),nativePromise:t=>b(s.nativePromise(t),"native Promise",t),promise:t=>b(s.promise(t),"Promise",t),generatorFunction:t=>b(s.generatorFunction(t),"GeneratorFunction",t),asyncGeneratorFunction:t=>b(s.asyncGeneratorFunction(t),"AsyncGeneratorFunction",t),asyncFunction:t=>b(s.asyncFunction(t),"AsyncFunction",t),boundFunction:t=>b(s.boundFunction(t),"Function",t),regExp:t=>b(s.regExp(t),"RegExp",t),date:t=>b(s.date(t),"Date",t),error:t=>b(s.error(t),"Error",t),map:t=>b(s.map(t),"Map",t),set:t=>b(s.set(t),"Set",t),weakMap:t=>b(s.weakMap(t),"WeakMap",t),weakSet:t=>b(s.weakSet(t),"WeakSet",t),int8Array:t=>b(s.int8Array(t),"Int8Array",t),uint8Array:t=>b(s.uint8Array(t),"Uint8Array",t),uint8ClampedArray:t=>b(s.uint8ClampedArray(t),"Uint8ClampedArray",t),int16Array:t=>b(s.int16Array(t),"Int16Array",t),uint16Array:t=>b(s.uint16Array(t),"Uint16Array",t),int32Array:t=>b(s.int32Array(t),"Int32Array",t),uint32Array:t=>b(s.uint32Array(t),"Uint32Array",t),float32Array:t=>b(s.float32Array(t),"Float32Array",t),float64Array:t=>b(s.float64Array(t),"Float64Array",t),bigInt64Array:t=>b(s.bigInt64Array(t),"BigInt64Array",t),bigUint64Array:t=>b(s.bigUint64Array(t),"BigUint64Array",t),arrayBuffer:t=>b(s.arrayBuffer(t),"ArrayBuffer",t),sharedArrayBuffer:t=>b(s.sharedArrayBuffer(t),"SharedArrayBuffer",t),dataView:t=>b(s.dataView(t),"DataView",t),urlInstance:t=>b(s.urlInstance(t),"URL",t),urlString:t=>b(s.urlString(t),"string with a URL",t),truthy:t=>b(s.truthy(t),"truthy",t),falsy:t=>b(s.falsy(t),"falsy",t),nan:t=>b(s.nan(t),"NaN",t),primitive:t=>b(s.primitive(t),"primitive",t),integer:t=>b(s.integer(t),"integer",t),safeInteger:t=>b(s.safeInteger(t),"integer",t),plainObject:t=>b(s.plainObject(t),"plain object",t),typedArray:t=>b(s.typedArray(t),"TypedArray",t),arrayLike:t=>b(s.arrayLike(t),"array-like",t),domElement:t=>b(s.domElement(t),"HTMLElement",t),observable:t=>b(s.observable(t),"Observable",t),nodeStream:t=>b(s.nodeStream(t),"Node.js Stream",t),infinite:t=>b(s.infinite(t),"infinite number",t),emptyArray:t=>b(s.emptyArray(t),"empty array",t),nonEmptyArray:t=>b(s.nonEmptyArray(t),"non-empty array",t),emptyString:t=>b(s.emptyString(t),"empty string",t),nonEmptyString:t=>b(s.nonEmptyString(t),"non-empty string",t),emptyStringOrWhitespace:t=>b(s.emptyStringOrWhitespace(t),"empty string or whitespace",t),emptyObject:t=>b(s.emptyObject(t),"empty object",t),nonEmptyObject:t=>b(s.nonEmptyObject(t),"non-empty object",t),emptySet:t=>b(s.emptySet(t),"empty set",t),nonEmptySet:t=>b(s.nonEmptySet(t),"non-empty set",t),emptyMap:t=>b(s.emptyMap(t),"empty map",t),nonEmptyMap:t=>b(s.nonEmptyMap(t),"non-empty map",t),propertyKey:t=>b(s.propertyKey(t),"PropertyKey",t),formData:t=>b(s.formData(t),"FormData",t),urlSearchParams:t=>b(s.urlSearchParams(t),"URLSearchParams",t),evenInteger:t=>b(s.evenInteger(t),"even integer",t),oddInteger:t=>b(s.oddInteger(t),"odd integer",t),directInstanceOf:(t,e)=>b(s.directInstanceOf(t,e),"T",t),inRange:(t,e)=>b(s.inRange(t,e),"in range",t),any:(t,...e)=>b(s.any(t,...e),"predicate returns truthy for any value",e,{multipleValues:!0}),all:(t,...e)=>b(s.all(t,...e),"predicate returns truthy for all values",e,{multipleValues:!0})},Object.defineProperties(s,{class:{value:s.class_},function:{value:s.function_},null:{value:s.null_}}),Object.defineProperties(e.assert,{class:{value:e.assert.class_},function:{value:e.assert.function_},null:{value:e.assert.null_}}),e.default=s,t.exports=s,t.exports.default=s,t.exports.assert=e.assert}(h,h.exports);var m=r(h.exports);function v(t,e){return Array.from(t).filter(((t,r)=>r!==e))}const _={skipContainers:!0,arrayStrictComparison:!1};t.deepContains=function t(e,r,n,o,u){const c={..._,...u};m(e)!==m(r)?o(`the first input arg is of a type ${m(e).toLowerCase()} but the second is ${m(r).toLowerCase()}. Values are - 1st:\n${JSON.stringify(e,null,4)}\n2nd:\n${JSON.stringify(r,null,4)}`):function(t,e){(function t(e,r,n,a){const o=i(e);let u;const c={depth:-1,path:"",...n};if(c.depth+=1,Array.isArray(o))for(let e=0,n=o.length;e<n&&!a.now;e++){const n=c.path?`${c.path}.${e}`:`${e}`;void 0!==o[e]?(c.parent=i(o),c.parentType="array",c.parentKey=g(n),u=t(r(o[e],void 0,{...c,path:n},a),r,{...c,path:n},a),Number.isNaN(u)&&e<o.length?(o.splice(e,1),e-=1):o[e]=u):o.splice(e,1)}else if(d(o))for(const e in o){if(a.now&&null!=e)break;const n=c.path?`${c.path}.${e}`:e;0===c.depth&&null!=e&&(c.topmostKey=e),c.parent=i(o),c.parentType="object",c.parentKey=g(n),u=t(r(e,o[e],{...c,path:n},a),r,{...c,path:n},a),Number.isNaN(u)?delete o[e]:o[e]=u}return o})(t,e,{},{now:!1})}(r,((r,i,u,s)=>{const l=void 0!==i?i:r,{path:f}=u;if(a.has(e,f))if(!c.arrayStrictComparison&&m.plainObject(l)&&"array"===u.parentType&&u.parent.length>1){s.now=!0;const r=Array.from(u.path.includes(".")?a.get(e,function(t){if(t.includes("."))for(let e=t.length;e--;)if("."===t[e])return t.slice(0,e);return t}(f)):e);if(r.length<u.parent.length)o(`the first array: ${JSON.stringify(r,null,4)}\nhas less objects than array we're matching against, ${JSON.stringify(u.parent,null,4)}`);else{const e=u.parent,a=r.map(((t,e)=>e));e.map(((t,e)=>e));const i=[];for(let t=0,e=a.length;t<e;t++){const e=[],r=a[t],n=v(a,t);e.push(r),n.forEach((t=>{i.push(Array.from(e).concat(t))}))}const s=i.map((t=>t.map(((t,e)=>[e,t]))));let l=0;for(let t=0,n=s.length;t<n;t++){let n=0;s[t].forEach((t=>{m.plainObject(e[t[0]])&&m.plainObject(r[t[1]])&&Object.keys(e[t[0]]).forEach((a=>{Object.keys(r[t[1]]).includes(a)&&(n+=1,r[t[1]][a]===e[t[0]][a]&&(n+=5))}))})),s[t].push(n),n>l&&(l=n)}for(let a=0,i=s.length;a<i;a++)if(s[a][2]===l){s[a].forEach(((i,u)=>{u<s[a].length-1&&t(r[i[1]],e[i[0]],n,o,c)}));break}}}else{const t=a.get(e,f);c.skipContainers&&(m.plainObject(t)||Array.isArray(t))||n(t,l,f)}else o(`the first input: ${JSON.stringify(e,null,4)}\ndoes not have the path "${f}", we were looking, would it contain a value ${JSON.stringify(l,null,0)}.`);return l}))},t.defaults=_,t.version="4.0.2",Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
26
|
+
*/var h={exports:{}};!function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const r=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];const n=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","FormData","URLSearchParams","HTMLElement",...r];const a=["null","undefined","string","number","bigint","boolean","symbol"];function o(t){return e=>typeof e===t}const{toString:i}=Object.prototype,u=t=>{const e=i.call(t).slice(8,-1);return/HTML\w+Element/.test(e)&&s.domElement(t)?"HTMLElement":n.includes(e)?e:void 0},c=t=>e=>u(e)===t;function s(t){if(null===t)return"null";switch(typeof t){case"undefined":return"undefined";case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"function":return"Function";case"bigint":return"bigint";case"symbol":return"symbol"}if(s.observable(t))return"Observable";if(s.array(t))return"Array";if(s.buffer(t))return"Buffer";const e=u(t);if(e)return e;if(t instanceof String||t instanceof Boolean||t instanceof Number)throw new TypeError("Please don't use object wrappers for primitive types");return"Object"}s.undefined=o("undefined"),s.string=o("string");const l=o("number");s.number=t=>l(t)&&!s.nan(t),s.bigint=o("bigint"),s.function_=o("function"),s.null_=t=>null===t,s.class_=t=>s.function_(t)&&t.toString().startsWith("class "),s.boolean=t=>!0===t||!1===t,s.symbol=o("symbol"),s.numericString=t=>s.string(t)&&!s.emptyStringOrWhitespace(t)&&!Number.isNaN(Number(t)),s.array=(t,e)=>!!Array.isArray(t)&&(!s.function_(e)||t.every(e)),s.buffer=t=>{var e,r,n,a;return null!==(a=null===(n=null===(r=null===(e=t)||void 0===e?void 0:e.constructor)||void 0===r?void 0:r.isBuffer)||void 0===n?void 0:n.call(r,t))&&void 0!==a&&a},s.nullOrUndefined=t=>s.null_(t)||s.undefined(t),s.object=t=>!s.null_(t)&&("object"==typeof t||s.function_(t)),s.iterable=t=>{var e;return s.function_(null===(e=t)||void 0===e?void 0:e[Symbol.iterator])},s.asyncIterable=t=>{var e;return s.function_(null===(e=t)||void 0===e?void 0:e[Symbol.asyncIterator])},s.generator=t=>s.iterable(t)&&s.function_(t.next)&&s.function_(t.throw),s.asyncGenerator=t=>s.asyncIterable(t)&&s.function_(t.next)&&s.function_(t.throw),s.nativePromise=t=>c("Promise")(t);s.promise=t=>s.nativePromise(t)||(t=>{var e,r;return s.function_(null===(e=t)||void 0===e?void 0:e.then)&&s.function_(null===(r=t)||void 0===r?void 0:r.catch)})(t),s.generatorFunction=c("GeneratorFunction"),s.asyncGeneratorFunction=t=>"AsyncGeneratorFunction"===u(t),s.asyncFunction=t=>"AsyncFunction"===u(t),s.boundFunction=t=>s.function_(t)&&!t.hasOwnProperty("prototype"),s.regExp=c("RegExp"),s.date=c("Date"),s.error=c("Error"),s.map=t=>c("Map")(t),s.set=t=>c("Set")(t),s.weakMap=t=>c("WeakMap")(t),s.weakSet=t=>c("WeakSet")(t),s.int8Array=c("Int8Array"),s.uint8Array=c("Uint8Array"),s.uint8ClampedArray=c("Uint8ClampedArray"),s.int16Array=c("Int16Array"),s.uint16Array=c("Uint16Array"),s.int32Array=c("Int32Array"),s.uint32Array=c("Uint32Array"),s.float32Array=c("Float32Array"),s.float64Array=c("Float64Array"),s.bigInt64Array=c("BigInt64Array"),s.bigUint64Array=c("BigUint64Array"),s.arrayBuffer=c("ArrayBuffer"),s.sharedArrayBuffer=c("SharedArrayBuffer"),s.dataView=c("DataView"),s.directInstanceOf=(t,e)=>Object.getPrototypeOf(t)===e.prototype,s.urlInstance=t=>c("URL")(t),s.urlString=t=>{if(!s.string(t))return!1;try{return new URL(t),!0}catch(t){return!1}},s.truthy=t=>Boolean(t),s.falsy=t=>!t,s.nan=t=>Number.isNaN(t),s.primitive=t=>s.null_(t)||a.includes(typeof t),s.integer=t=>Number.isInteger(t),s.safeInteger=t=>Number.isSafeInteger(t),s.plainObject=t=>{if("[object Object]"!==i.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.getPrototypeOf({})},s.typedArray=t=>{return e=u(t),r.includes(e);var e};s.arrayLike=t=>!s.nullOrUndefined(t)&&!s.function_(t)&&(t=>s.safeInteger(t)&&t>=0)(t.length),s.inRange=(t,e)=>{if(s.number(e))return t>=Math.min(0,e)&&t<=Math.max(e,0);if(s.array(e)&&2===e.length)return t>=Math.min(...e)&&t<=Math.max(...e);throw new TypeError(`Invalid range: ${JSON.stringify(e)}`)};const f=["innerHTML","ownerDocument","style","attributes","nodeValue"];s.domElement=t=>s.object(t)&&1===t.nodeType&&s.string(t.nodeName)&&!s.plainObject(t)&&f.every((e=>e in t)),s.observable=t=>{var e,r,n,a;return!!t&&(t===(null===(r=(e=t)[Symbol.observable])||void 0===r?void 0:r.call(e))||t===(null===(a=(n=t)["@@observable"])||void 0===a?void 0:a.call(n)))},s.nodeStream=t=>s.object(t)&&s.function_(t.pipe)&&!s.observable(t),s.infinite=t=>t===1/0||t===-1/0;const y=t=>e=>s.integer(e)&&Math.abs(e%2)===t;s.evenInteger=y(0),s.oddInteger=y(1),s.emptyArray=t=>s.array(t)&&0===t.length,s.nonEmptyArray=t=>s.array(t)&&t.length>0,s.emptyString=t=>s.string(t)&&0===t.length,s.nonEmptyString=t=>s.string(t)&&t.length>0;s.emptyStringOrWhitespace=t=>s.emptyString(t)||(t=>s.string(t)&&!/\S/.test(t))(t),s.emptyObject=t=>s.object(t)&&!s.map(t)&&!s.set(t)&&0===Object.keys(t).length,s.nonEmptyObject=t=>s.object(t)&&!s.map(t)&&!s.set(t)&&Object.keys(t).length>0,s.emptySet=t=>s.set(t)&&0===t.size,s.nonEmptySet=t=>s.set(t)&&t.size>0,s.emptyMap=t=>s.map(t)&&0===t.size,s.nonEmptyMap=t=>s.map(t)&&t.size>0,s.propertyKey=t=>s.any([s.string,s.number,s.symbol],t),s.formData=t=>c("FormData")(t),s.urlSearchParams=t=>c("URLSearchParams")(t);const p=(t,e,r)=>{if(!s.function_(e))throw new TypeError(`Invalid predicate: ${JSON.stringify(e)}`);if(0===r.length)throw new TypeError("Invalid number of values");return t.call(r,e)};s.any=(t,...e)=>(s.array(t)?t:[t]).some((t=>p(Array.prototype.some,t,e))),s.all=(t,...e)=>p(Array.prototype.every,t,e);const b=(t,e,r,n={})=>{if(!t){const{multipleValues:t}=n,a=t?`received values of types ${[...new Set(r.map((t=>`\`${s(t)}\``)))].join(", ")}`:`received value of type \`${s(r)}\``;throw new TypeError(`Expected value which is \`${e}\`, ${a}.`)}};e.assert={undefined:t=>b(s.undefined(t),"undefined",t),string:t=>b(s.string(t),"string",t),number:t=>b(s.number(t),"number",t),bigint:t=>b(s.bigint(t),"bigint",t),function_:t=>b(s.function_(t),"Function",t),null_:t=>b(s.null_(t),"null",t),class_:t=>b(s.class_(t),"Class",t),boolean:t=>b(s.boolean(t),"boolean",t),symbol:t=>b(s.symbol(t),"symbol",t),numericString:t=>b(s.numericString(t),"string with a number",t),array:(t,e)=>{b(s.array(t),"Array",t),e&&t.forEach(e)},buffer:t=>b(s.buffer(t),"Buffer",t),nullOrUndefined:t=>b(s.nullOrUndefined(t),"null or undefined",t),object:t=>b(s.object(t),"Object",t),iterable:t=>b(s.iterable(t),"Iterable",t),asyncIterable:t=>b(s.asyncIterable(t),"AsyncIterable",t),generator:t=>b(s.generator(t),"Generator",t),asyncGenerator:t=>b(s.asyncGenerator(t),"AsyncGenerator",t),nativePromise:t=>b(s.nativePromise(t),"native Promise",t),promise:t=>b(s.promise(t),"Promise",t),generatorFunction:t=>b(s.generatorFunction(t),"GeneratorFunction",t),asyncGeneratorFunction:t=>b(s.asyncGeneratorFunction(t),"AsyncGeneratorFunction",t),asyncFunction:t=>b(s.asyncFunction(t),"AsyncFunction",t),boundFunction:t=>b(s.boundFunction(t),"Function",t),regExp:t=>b(s.regExp(t),"RegExp",t),date:t=>b(s.date(t),"Date",t),error:t=>b(s.error(t),"Error",t),map:t=>b(s.map(t),"Map",t),set:t=>b(s.set(t),"Set",t),weakMap:t=>b(s.weakMap(t),"WeakMap",t),weakSet:t=>b(s.weakSet(t),"WeakSet",t),int8Array:t=>b(s.int8Array(t),"Int8Array",t),uint8Array:t=>b(s.uint8Array(t),"Uint8Array",t),uint8ClampedArray:t=>b(s.uint8ClampedArray(t),"Uint8ClampedArray",t),int16Array:t=>b(s.int16Array(t),"Int16Array",t),uint16Array:t=>b(s.uint16Array(t),"Uint16Array",t),int32Array:t=>b(s.int32Array(t),"Int32Array",t),uint32Array:t=>b(s.uint32Array(t),"Uint32Array",t),float32Array:t=>b(s.float32Array(t),"Float32Array",t),float64Array:t=>b(s.float64Array(t),"Float64Array",t),bigInt64Array:t=>b(s.bigInt64Array(t),"BigInt64Array",t),bigUint64Array:t=>b(s.bigUint64Array(t),"BigUint64Array",t),arrayBuffer:t=>b(s.arrayBuffer(t),"ArrayBuffer",t),sharedArrayBuffer:t=>b(s.sharedArrayBuffer(t),"SharedArrayBuffer",t),dataView:t=>b(s.dataView(t),"DataView",t),urlInstance:t=>b(s.urlInstance(t),"URL",t),urlString:t=>b(s.urlString(t),"string with a URL",t),truthy:t=>b(s.truthy(t),"truthy",t),falsy:t=>b(s.falsy(t),"falsy",t),nan:t=>b(s.nan(t),"NaN",t),primitive:t=>b(s.primitive(t),"primitive",t),integer:t=>b(s.integer(t),"integer",t),safeInteger:t=>b(s.safeInteger(t),"integer",t),plainObject:t=>b(s.plainObject(t),"plain object",t),typedArray:t=>b(s.typedArray(t),"TypedArray",t),arrayLike:t=>b(s.arrayLike(t),"array-like",t),domElement:t=>b(s.domElement(t),"HTMLElement",t),observable:t=>b(s.observable(t),"Observable",t),nodeStream:t=>b(s.nodeStream(t),"Node.js Stream",t),infinite:t=>b(s.infinite(t),"infinite number",t),emptyArray:t=>b(s.emptyArray(t),"empty array",t),nonEmptyArray:t=>b(s.nonEmptyArray(t),"non-empty array",t),emptyString:t=>b(s.emptyString(t),"empty string",t),nonEmptyString:t=>b(s.nonEmptyString(t),"non-empty string",t),emptyStringOrWhitespace:t=>b(s.emptyStringOrWhitespace(t),"empty string or whitespace",t),emptyObject:t=>b(s.emptyObject(t),"empty object",t),nonEmptyObject:t=>b(s.nonEmptyObject(t),"non-empty object",t),emptySet:t=>b(s.emptySet(t),"empty set",t),nonEmptySet:t=>b(s.nonEmptySet(t),"non-empty set",t),emptyMap:t=>b(s.emptyMap(t),"empty map",t),nonEmptyMap:t=>b(s.nonEmptyMap(t),"non-empty map",t),propertyKey:t=>b(s.propertyKey(t),"PropertyKey",t),formData:t=>b(s.formData(t),"FormData",t),urlSearchParams:t=>b(s.urlSearchParams(t),"URLSearchParams",t),evenInteger:t=>b(s.evenInteger(t),"even integer",t),oddInteger:t=>b(s.oddInteger(t),"odd integer",t),directInstanceOf:(t,e)=>b(s.directInstanceOf(t,e),"T",t),inRange:(t,e)=>b(s.inRange(t,e),"in range",t),any:(t,...e)=>b(s.any(t,...e),"predicate returns truthy for any value",e,{multipleValues:!0}),all:(t,...e)=>b(s.all(t,...e),"predicate returns truthy for all values",e,{multipleValues:!0})},Object.defineProperties(s,{class:{value:s.class_},function:{value:s.function_},null:{value:s.null_}}),Object.defineProperties(e.assert,{class:{value:e.assert.class_},function:{value:e.assert.function_},null:{value:e.assert.null_}}),e.default=s,t.exports=s,t.exports.default=s,t.exports.assert=e.assert}(h,h.exports);var m=r(h.exports);function v(t,e){return Array.from(t).filter(((t,r)=>r!==e))}const _={skipContainers:!0,arrayStrictComparison:!1};t.deepContains=function t(e,r,n,o,u){const c={..._,...u};m(e)!==m(r)?o(`the first input arg is of a type ${m(e).toLowerCase()} but the second is ${m(r).toLowerCase()}. Values are - 1st:\n${JSON.stringify(e,null,4)}\n2nd:\n${JSON.stringify(r,null,4)}`):function(t,e){(function t(e,r,n,a){const o=i(e);let u;const c={depth:-1,path:"",...n};if(c.depth+=1,Array.isArray(o))for(let e=0,n=o.length;e<n&&!a.now;e++){const n=c.path?`${c.path}.${e}`:`${e}`;void 0!==o[e]?(c.parent=i(o),c.parentType="array",c.parentKey=g(n),u=t(r(o[e],void 0,{...c,path:n},a),r,{...c,path:n},a),Number.isNaN(u)&&e<o.length?(o.splice(e,1),e-=1):o[e]=u):o.splice(e,1)}else if(d(o))for(const e in o){if(a.now&&null!=e)break;const n=c.path?`${c.path}.${e}`:e;0===c.depth&&null!=e&&(c.topmostKey=e),c.parent=i(o),c.parentType="object",c.parentKey=g(n),u=t(r(e,o[e],{...c,path:n},a),r,{...c,path:n},a),Number.isNaN(u)?delete o[e]:o[e]=u}return o})(t,e,{},{now:!1})}(r,((r,i,u,s)=>{const l=void 0!==i?i:r,{path:f}=u;if(a.has(e,f))if(!c.arrayStrictComparison&&m.plainObject(l)&&"array"===u.parentType&&u.parent.length>1){s.now=!0;const r=Array.from(u.path.includes(".")?a.get(e,function(t){if(t.includes("."))for(let e=t.length;e--;)if("."===t[e])return t.slice(0,e);return t}(f)):e);if(r.length<u.parent.length)o(`the first array: ${JSON.stringify(r,null,4)}\nhas less objects than array we're matching against, ${JSON.stringify(u.parent,null,4)}`);else{const e=u.parent,a=r.map(((t,e)=>e));e.map(((t,e)=>e));const i=[];for(let t=0,e=a.length;t<e;t++){const e=[],r=a[t],n=v(a,t);e.push(r),n.forEach((t=>{i.push(Array.from(e).concat(t))}))}const s=i.map((t=>t.map(((t,e)=>[e,t]))));let l=0;for(let t=0,n=s.length;t<n;t++){let n=0;s[t].forEach((t=>{m.plainObject(e[t[0]])&&m.plainObject(r[t[1]])&&Object.keys(e[t[0]]).forEach((a=>{Object.keys(r[t[1]]).includes(a)&&(n+=1,r[t[1]][a]===e[t[0]][a]&&(n+=5))}))})),s[t].push(n),n>l&&(l=n)}for(let a=0,i=s.length;a<i;a++)if(s[a][2]===l){s[a].forEach(((i,u)=>{u<s[a].length-1&&t(r[i[1]],e[i[0]],n,o,c)}));break}}}else{const t=a.get(e,f);c.skipContainers&&(m.plainObject(t)||Array.isArray(t))||n(t,l,f)}else o(`the first input: ${JSON.stringify(e,null,4)}\ndoes not have the path "${f}", we were looking, would it contain a value ${JSON.stringify(l,null,0)}.`);return l}))},t.defaults=_,t.version="4.0.6",Object.defineProperty(t,"__esModule",{value:!0})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ast-deep-contains",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.6",
|
|
4
4
|
"description": "Like t.same assert on array of objects, where element order doesn't matter.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"array",
|
|
@@ -49,9 +49,10 @@
|
|
|
49
49
|
"types": "types/index.d.ts",
|
|
50
50
|
"scripts": {
|
|
51
51
|
"build": "rollup -c",
|
|
52
|
-
"esbuild": "node '../../scripts/esbuild.js'",
|
|
53
|
-
"
|
|
54
|
-
"ci_test": "npm run build && npm run format && tap --no-only --reporter=silent
|
|
52
|
+
"build:esbuild": "node '../../scripts/esbuild.js'",
|
|
53
|
+
"build:esbuild:dev": "cross-env MODE=dev node '../../scripts/esbuild.js'",
|
|
54
|
+
"ci_test": "npm run build && npm run format && tap --no-only --reporter=silent",
|
|
55
|
+
"clean_types": "../../scripts/cleanTypes.js",
|
|
55
56
|
"dev": "rollup -c --dev",
|
|
56
57
|
"devunittest": "npm run dev && tap --only -R 'base'",
|
|
57
58
|
"format": "npm run lect && npm run prettier && npm run lint",
|
|
@@ -61,20 +62,15 @@
|
|
|
61
62
|
"prettier": "../../node_modules/prettier/bin-prettier.js '*.{js,css,scss,vue,md,ts}' --write --loglevel silent",
|
|
62
63
|
"republish": "npm publish || :",
|
|
63
64
|
"tap": "tap",
|
|
64
|
-
"tsc": "tsc",
|
|
65
65
|
"pretest": "npm run build",
|
|
66
|
-
"test": "npm run
|
|
66
|
+
"test": "npm run test:ci && npm run perf",
|
|
67
|
+
"test:ci": "npm run unittest && npm run test:examples && npm run format",
|
|
67
68
|
"test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"clean_types": "../../scripts/cleanTypes.js"
|
|
69
|
+
"tsc": "tsc",
|
|
70
|
+
"unittest": "tap --no-only --reporter=terse && tsc -p tsconfig.json --noEmit"
|
|
71
71
|
},
|
|
72
72
|
"tap": {
|
|
73
73
|
"check-coverage": false,
|
|
74
|
-
"coverage-report": [
|
|
75
|
-
"json-summary",
|
|
76
|
-
"text"
|
|
77
|
-
],
|
|
78
74
|
"node-arg": [
|
|
79
75
|
"--no-warnings",
|
|
80
76
|
"--experimental-loader",
|
|
@@ -97,52 +93,52 @@
|
|
|
97
93
|
}
|
|
98
94
|
},
|
|
99
95
|
"dependencies": {
|
|
100
|
-
"@babel/runtime": "^7.
|
|
101
|
-
"@sindresorhus/is": "^4.
|
|
102
|
-
"ast-monkey-traverse": "^3.0.
|
|
103
|
-
"object-path": "^0.11.
|
|
96
|
+
"@babel/runtime": "^7.16.3",
|
|
97
|
+
"@sindresorhus/is": "^4.2.0",
|
|
98
|
+
"ast-monkey-traverse": "^3.0.6",
|
|
99
|
+
"object-path": "^0.11.8"
|
|
104
100
|
},
|
|
105
101
|
"devDependencies": {
|
|
106
|
-
"@babel/cli": "^7.
|
|
107
|
-
"@babel/core": "^7.
|
|
108
|
-
"@babel/node": "^7.
|
|
109
|
-
"@babel/plugin-external-helpers": "^7.
|
|
110
|
-
"@babel/plugin-proposal-class-properties": "^7.
|
|
111
|
-
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.
|
|
112
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.
|
|
113
|
-
"@babel/plugin-proposal-optional-chaining": "^7.
|
|
114
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
115
|
-
"@babel/preset-env": "^7.
|
|
116
|
-
"@babel/preset-typescript": "^7.
|
|
117
|
-
"@babel/register": "^7.
|
|
102
|
+
"@babel/cli": "^7.16.0",
|
|
103
|
+
"@babel/core": "^7.16.0",
|
|
104
|
+
"@babel/node": "^7.16.0",
|
|
105
|
+
"@babel/plugin-external-helpers": "^7.16.0",
|
|
106
|
+
"@babel/plugin-proposal-class-properties": "^7.16.0",
|
|
107
|
+
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
|
|
108
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.16.0",
|
|
109
|
+
"@babel/plugin-proposal-optional-chaining": "^7.16.0",
|
|
110
|
+
"@babel/plugin-transform-runtime": "^7.16.4",
|
|
111
|
+
"@babel/preset-env": "^7.16.4",
|
|
112
|
+
"@babel/preset-typescript": "^7.16.0",
|
|
113
|
+
"@babel/register": "^7.16.0",
|
|
118
114
|
"@istanbuljs/esm-loader-hook": "^0.1.2",
|
|
119
115
|
"@rollup/plugin-babel": "^5.3.0",
|
|
120
|
-
"@rollup/plugin-commonjs": "^
|
|
116
|
+
"@rollup/plugin-commonjs": "^21.0.1",
|
|
121
117
|
"@rollup/plugin-json": "^4.1.0",
|
|
122
|
-
"@rollup/plugin-node-resolve": "^13.0.
|
|
118
|
+
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
123
119
|
"@rollup/plugin-strip": "^2.1.0",
|
|
124
|
-
"@rollup/plugin-typescript": "^8.
|
|
120
|
+
"@rollup/plugin-typescript": "^8.3.0",
|
|
125
121
|
"@types/lodash.isplainobject": "^4.0.6",
|
|
126
|
-
"@types/node": "^16.9
|
|
122
|
+
"@types/node": "^16.11.9",
|
|
127
123
|
"@types/object-path": "^0.11.1",
|
|
128
124
|
"@types/tap": "^15.0.5",
|
|
129
|
-
"@typescript-eslint/eslint-plugin": "^4.
|
|
130
|
-
"@typescript-eslint/parser": "^4.
|
|
131
|
-
"core-js": "^3.
|
|
125
|
+
"@typescript-eslint/eslint-plugin": "^5.4.0",
|
|
126
|
+
"@typescript-eslint/parser": "^5.4.0",
|
|
127
|
+
"core-js": "^3.19.1",
|
|
132
128
|
"cross-env": "^7.0.3",
|
|
133
|
-
"eslint": "^
|
|
134
|
-
"lect": "^0.18.
|
|
135
|
-
"rollup": "^2.
|
|
129
|
+
"eslint": "^8.3.0",
|
|
130
|
+
"lect": "^0.18.6",
|
|
131
|
+
"rollup": "^2.60.0",
|
|
136
132
|
"rollup-plugin-ascii": "^0.0.3",
|
|
137
133
|
"rollup-plugin-banner": "^0.2.1",
|
|
138
134
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
139
|
-
"rollup-plugin-dts": "^4.0.
|
|
135
|
+
"rollup-plugin-dts": "^4.0.1",
|
|
140
136
|
"rollup-plugin-terser": "^7.0.2",
|
|
141
|
-
"tap": "^15.
|
|
137
|
+
"tap": "^15.1.2",
|
|
142
138
|
"tslib": "^2.3.1",
|
|
143
|
-
"typescript": "^4.
|
|
139
|
+
"typescript": "^4.5.2"
|
|
144
140
|
},
|
|
145
141
|
"engines": {
|
|
146
|
-
"node": ">=
|
|
142
|
+
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
|
147
143
|
}
|
|
148
144
|
}
|