@blackglory/match 0.3.2 → 0.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/es2015/index.min.mjs +1 -1
- package/dist/es2015/index.min.mjs.map +1 -1
- package/dist/es2015/index.mjs +1543 -586
- package/dist/es2015/index.mjs.map +1 -1
- package/dist/es2015/index.umd.js +1545 -588
- package/dist/es2015/index.umd.js.map +1 -1
- package/dist/es2015/index.umd.min.js +1 -1
- package/dist/es2015/index.umd.min.js.map +1 -1
- package/dist/es2018/index.min.mjs +1 -1
- package/dist/es2018/index.min.mjs.map +1 -1
- package/dist/es2018/index.mjs +1543 -586
- package/dist/es2018/index.mjs.map +1 -1
- package/dist/es2018/index.umd.js +1545 -588
- package/dist/es2018/index.umd.js.map +1 -1
- package/dist/es2018/index.umd.min.js +1 -1
- package/dist/es2018/index.umd.min.js.map +1 -1
- package/lib/es2015/match-element.js +2 -2
- package/lib/es2015/match-element.js.map +1 -1
- package/lib/es2015/match.js +2 -2
- package/lib/es2015/match.js.map +1 -1
- package/lib/es2015/matchers/child-nodes.js +3 -3
- package/lib/es2015/matchers/child-nodes.js.map +1 -1
- package/lib/es2015/matchers/children.js +3 -3
- package/lib/es2015/matchers/children.js.map +1 -1
- package/lib/es2015/matchers/css.js +2 -2
- package/lib/es2015/matchers/css.js.map +1 -1
- package/lib/es2015/matchers/element.js +6 -6
- package/lib/es2015/matchers/element.js.map +1 -1
- package/lib/es2015/matchers/multiple.js +5 -5
- package/lib/es2015/matchers/multiple.js.map +1 -1
- package/lib/es2015/matchers/node.js +5 -5
- package/lib/es2015/matchers/node.js.map +1 -1
- package/lib/es2015/matchers/optional.js +1 -1
- package/lib/es2015/matchers/optional.js.map +1 -1
- package/lib/es2015/matchers/repeat.js +2 -2
- package/lib/es2015/matchers/repeat.js.map +1 -1
- package/lib/es2015/matchers/text-content-equals.js +1 -1
- package/lib/es2015/matchers/text-content-equals.js.map +1 -1
- package/lib/es2015/matchers/text-content-includes.js +1 -1
- package/lib/es2015/matchers/text-content-includes.js.map +1 -1
- package/lib/es2015/matchers/text-content-matches.js +1 -1
- package/lib/es2015/matchers/text-content-matches.js.map +1 -1
- package/lib/es2015/matchers/text-node.js +6 -6
- package/lib/es2015/matchers/text-node.js.map +1 -1
- package/lib/es2015/matchers/xpath.js +3 -3
- package/lib/es2015/matchers/xpath.js.map +1 -1
- package/lib/es2015/utils/match-multiple.js +1 -1
- package/lib/es2015/utils/match-multiple.js.map +1 -1
- package/lib/es2015/utils/match-one-by-one.js +3 -3
- package/lib/es2015/utils/match-one-by-one.js.map +1 -1
- package/lib/{es2018/utils/merge.d.ts → es2015/utils/merge-in-place.d.ts} +1 -1
- package/lib/{es2018/utils/merge.js → es2015/utils/merge-in-place.js} +8 -7
- package/lib/es2015/utils/merge-in-place.js.map +1 -0
- package/lib/es2018/match-element.js +2 -2
- package/lib/es2018/match-element.js.map +1 -1
- package/lib/es2018/match.js +2 -2
- package/lib/es2018/match.js.map +1 -1
- package/lib/es2018/matchers/child-nodes.js +3 -3
- package/lib/es2018/matchers/child-nodes.js.map +1 -1
- package/lib/es2018/matchers/children.js +3 -3
- package/lib/es2018/matchers/children.js.map +1 -1
- package/lib/es2018/matchers/css.js +2 -2
- package/lib/es2018/matchers/css.js.map +1 -1
- package/lib/es2018/matchers/element.js +6 -6
- package/lib/es2018/matchers/element.js.map +1 -1
- package/lib/es2018/matchers/multiple.js +5 -5
- package/lib/es2018/matchers/multiple.js.map +1 -1
- package/lib/es2018/matchers/node.js +5 -5
- package/lib/es2018/matchers/node.js.map +1 -1
- package/lib/es2018/matchers/optional.js +1 -1
- package/lib/es2018/matchers/optional.js.map +1 -1
- package/lib/es2018/matchers/repeat.js +2 -2
- package/lib/es2018/matchers/repeat.js.map +1 -1
- package/lib/es2018/matchers/text-content-equals.js +1 -1
- package/lib/es2018/matchers/text-content-equals.js.map +1 -1
- package/lib/es2018/matchers/text-content-includes.js +1 -1
- package/lib/es2018/matchers/text-content-includes.js.map +1 -1
- package/lib/es2018/matchers/text-content-matches.js +1 -1
- package/lib/es2018/matchers/text-content-matches.js.map +1 -1
- package/lib/es2018/matchers/text-node.js +6 -6
- package/lib/es2018/matchers/text-node.js.map +1 -1
- package/lib/es2018/matchers/xpath.js +3 -3
- package/lib/es2018/matchers/xpath.js.map +1 -1
- package/lib/es2018/utils/match-multiple.js +1 -1
- package/lib/es2018/utils/match-multiple.js.map +1 -1
- package/lib/es2018/utils/match-one-by-one.js +3 -3
- package/lib/es2018/utils/match-one-by-one.js.map +1 -1
- package/lib/{es2015/utils/merge.d.ts → es2018/utils/merge-in-place.d.ts} +1 -1
- package/lib/{es2015/utils/merge.js → es2018/utils/merge-in-place.js} +8 -7
- package/lib/es2018/utils/merge-in-place.js.map +1 -0
- package/package.json +24 -24
- package/CHANGELOG.md +0 -60
- package/lib/es2015/utils/merge.js.map +0 -1
- package/lib/es2018/utils/merge.js.map +0 -1
|
@@ -4,13 +4,13 @@ exports.css = void 0;
|
|
|
4
4
|
const concat_1 = require("../utils/concat");
|
|
5
5
|
const types_1 = require("@blackglory/types");
|
|
6
6
|
function css(...args) {
|
|
7
|
-
if (types_1.isString(args[0])) {
|
|
7
|
+
if ((0, types_1.isString)(args[0])) {
|
|
8
8
|
const [selector] = args;
|
|
9
9
|
return (element) => element.matches(selector);
|
|
10
10
|
}
|
|
11
11
|
else {
|
|
12
12
|
const [strings, ...values] = args;
|
|
13
|
-
const selector = concat_1.concat(strings, values).join('');
|
|
13
|
+
const selector = (0, concat_1.concat)(strings, values).join('');
|
|
14
14
|
return css(selector);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css.js","sourceRoot":"","sources":["../../../src/matchers/css.ts"],"names":[],"mappings":";;;AAAA,0CAAsC;AAEtC,6CAA4C;AAO5C,SAAgB,GAAG,CAAC,GAAG,IAE+B;IAEpD,IAAI,gBAAQ,
|
|
1
|
+
{"version":3,"file":"css.js","sourceRoot":"","sources":["../../../src/matchers/css.ts"],"names":[],"mappings":";;;AAAA,0CAAsC;AAEtC,6CAA4C;AAO5C,SAAgB,GAAG,CAAC,GAAG,IAE+B;IAEpD,IAAI,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;QACrB,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAA;QAEvB,OAAO,CAAC,OAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;KACvD;SAAM;QACL,MAAM,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,GAAG,IAAI,CAAA;QACjC,MAAM,QAAQ,GAAG,IAAA,eAAM,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAEjD,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAA;KACrB;AACH,CAAC;AAdD,kBAcC"}
|
|
@@ -4,26 +4,26 @@ exports.element = void 0;
|
|
|
4
4
|
const extra_dom_1 = require("extra-dom");
|
|
5
5
|
const types_1 = require("@blackglory/types");
|
|
6
6
|
const concat_1 = require("../utils/concat");
|
|
7
|
-
const
|
|
7
|
+
const merge_in_place_1 = require("../utils/merge-in-place");
|
|
8
8
|
function element(...args) {
|
|
9
|
-
if (
|
|
9
|
+
if ((0, types_1.isArray)(args[0])) {
|
|
10
10
|
const [strings, ...values] = args;
|
|
11
|
-
const name = concat_1.concat(strings, values).join('');
|
|
11
|
+
const name = (0, concat_1.concat)(strings, values).join('');
|
|
12
12
|
return (...matchers) => element(name, ...matchers);
|
|
13
13
|
}
|
|
14
|
-
if (types_1.isString(args[0])) {
|
|
14
|
+
if ((0, types_1.isString)(args[0])) {
|
|
15
15
|
const [name, ...matchers] = args;
|
|
16
16
|
return function (_element) {
|
|
17
17
|
const result = element(...matchers).call(this, _element);
|
|
18
18
|
if (result) {
|
|
19
|
-
|
|
19
|
+
(0, merge_in_place_1.mergeInPlace)(this.collection, { [name]: _element });
|
|
20
20
|
}
|
|
21
21
|
return result;
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
const [...matchers] = args;
|
|
25
25
|
return function (element) {
|
|
26
|
-
if (extra_dom_1.isntElement(element))
|
|
26
|
+
if ((0, extra_dom_1.isntElement)(element))
|
|
27
27
|
return false;
|
|
28
28
|
if (matchers.length === 0)
|
|
29
29
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../../src/matchers/element.ts"],"names":[],"mappings":";;;AAAA,yCAAuC;AAEvC,
|
|
1
|
+
{"version":3,"file":"element.js","sourceRoot":"","sources":["../../../src/matchers/element.ts"],"names":[],"mappings":";;;AAAA,yCAAuC;AAEvC,6CAAqD;AACrD,0CAAsC;AACtC,0DAAoD;AAUpD,SAAgB,OAAO,CAAC,GAAG,IAGgD;IAEzE,IAAI,IAAA,eAAO,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;QACpB,MAAM,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,GACxB,IAA4D,CAAA;QAC9D,MAAM,IAAI,GAAG,IAAA,eAAM,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAE7C,OAAO,CAAC,GAAG,QAAoE,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,QAAQ,CAAC,CAAA;KAC/G;IAED,IAAI,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;QACrB,MAAM,CAAC,IAAI,EAAE,GAAG,QAAQ,CAAC,GACvB,IAA+F,CAAA;QAEjG,OAAO,UAAkC,QAAiB;YACxD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;YACxD,IAAI,MAAM,EAAE;gBACV,IAAA,6BAAY,EAAC,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAA;aACpD;YACD,OAAO,MAAM,CAAA;QACf,CAAC,CAAA;KACF;IAED,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,IAAiF,CAAA;IAEvG,OAAO,UAAkC,OAAgB;QACvD,IAAI,IAAA,uBAAW,EAAC,OAAO,CAAC;YAAE,OAAO,KAAK,CAAA;QACtC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAA;QAEtC,OAAO,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAA;IAC3D,CAAC,CAAA;AACH,CAAC;AAlCD,0BAkCC"}
|
|
@@ -10,10 +10,10 @@ var Range;
|
|
|
10
10
|
Range[Range["Max"] = 1] = "Max";
|
|
11
11
|
})(Range = exports.Range || (exports.Range = {}));
|
|
12
12
|
function multiple([min, max], matcher, options = { greedy: true }) {
|
|
13
|
-
errors_1.assert(Number.isInteger(min), 'parameter min must be an integer');
|
|
14
|
-
errors_1.assert(Number.isInteger(max) || max === Infinity, 'parameter max must be an integer or Infinity');
|
|
15
|
-
errors_1.assert(min >= 0, 'parameter min must be greater than or equal to 0');
|
|
16
|
-
errors_1.assert(min <= max, 'parameter max must be greater than or equal to min');
|
|
13
|
+
(0, errors_1.assert)(Number.isInteger(min), 'parameter min must be an integer');
|
|
14
|
+
(0, errors_1.assert)(Number.isInteger(max) || max === Infinity, 'parameter max must be an integer or Infinity');
|
|
15
|
+
(0, errors_1.assert)(min >= 0, 'parameter min must be greater than or equal to 0');
|
|
16
|
+
(0, errors_1.assert)(min <= max, 'parameter max must be greater than or equal to min');
|
|
17
17
|
return function* (node) {
|
|
18
18
|
if (options.greedy) {
|
|
19
19
|
let ubound = max;
|
|
@@ -28,7 +28,7 @@ function multiple([min, max], matcher, options = { greedy: true }) {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
|
-
for (const ubound of extra_generator_1.countup(min, max)) {
|
|
31
|
+
for (const ubound of (0, extra_generator_1.countup)(min, max)) {
|
|
32
32
|
const result = match_multiple_1.matchMultiple.call(this, node, ubound, matcher);
|
|
33
33
|
if (result < ubound)
|
|
34
34
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiple.js","sourceRoot":"","sources":["../../../src/matchers/multiple.ts"],"names":[],"mappings":";;;AACA,qDAAyC;AACzC,+CAA2C;AAC3C,0DAAqD;AAErD,IAAY,KAGX;AAHD,WAAY,KAAK;IACf,+BAAO,CAAA;IACP,+BAAO,CAAA;AACT,CAAC,EAHW,KAAK,GAAL,aAAK,KAAL,aAAK,QAGhB;AAOD,SAAgB,QAAQ,CACtB,CAAC,GAAG,EAAE,GAAG,CAA6B,EACtC,OAAgD,EAChD,UAA4B,EAAE,MAAM,EAAE,IAAI,EAAE;IAE5C,eAAM,
|
|
1
|
+
{"version":3,"file":"multiple.js","sourceRoot":"","sources":["../../../src/matchers/multiple.ts"],"names":[],"mappings":";;;AACA,qDAAyC;AACzC,+CAA2C;AAC3C,0DAAqD;AAErD,IAAY,KAGX;AAHD,WAAY,KAAK;IACf,+BAAO,CAAA;IACP,+BAAO,CAAA;AACT,CAAC,EAHW,KAAK,GAAL,aAAK,KAAL,aAAK,QAGhB;AAOD,SAAgB,QAAQ,CACtB,CAAC,GAAG,EAAE,GAAG,CAA6B,EACtC,OAAgD,EAChD,UAA4B,EAAE,MAAM,EAAE,IAAI,EAAE;IAE5C,IAAA,eAAM,EAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,kCAAkC,CAAC,CAAA;IACjE,IAAA,eAAM,EAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,QAAQ,EAAE,8CAA8C,CAAC,CAAA;IACjG,IAAA,eAAM,EAAC,GAAG,IAAI,CAAC,EAAE,kDAAkD,CAAC,CAAA;IACpE,IAAA,eAAM,EAAC,GAAG,IAAI,GAAG,EAAE,oDAAoD,CAAC,CAAA;IAExE,OAAO,QAAQ,CAAC,EAA0B,IAAO;QAC/C,IAAI,OAAO,CAAC,MAAM,EAAE;YAClB,IAAI,MAAM,GAAG,GAAG,CAAA;YAChB,OAAO,IAAI,EAAE;gBACX,MAAM,KAAK,GAAG,8BAAa,CAAC,IAAI,CAC9B,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,OAAwD,CACzD,CAAA;gBAED,IAAI,KAAK,GAAG,GAAG;oBAAE,MAAK;gBACtB,MAAM,KAAK,CAAA;gBAEX,MAAM,GAAG,KAAK,GAAG,CAAC,CAAA;gBAClB,IAAI,MAAM,GAAG,GAAG;oBAAE,MAAK;aACxB;SACF;aAAM;YACL,KAAK,MAAM,MAAM,IAAI,IAAA,yBAAO,EAAC,GAAG,EAAE,GAAG,CAAC,EAAE;gBACtC,MAAM,MAAM,GAAG,8BAAa,CAAC,IAAI,CAC/B,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,OAAsD,CACvD,CAAA;gBAGD,IAAI,MAAM,GAAG,MAAM;oBAAE,MAAK;gBAE1B,IAAI,MAAM,KAAK,MAAM;oBAAE,MAAM,MAAM,CAAA;aACpC;SACF;IACH,CAAC,CAAA;AACH,CAAC;AA3CD,4BA2CC"}
|
|
@@ -3,19 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.node = void 0;
|
|
4
4
|
const types_1 = require("@blackglory/types");
|
|
5
5
|
const concat_1 = require("../utils/concat");
|
|
6
|
-
const
|
|
6
|
+
const merge_in_place_1 = require("../utils/merge-in-place");
|
|
7
7
|
function node(...args) {
|
|
8
|
-
if (
|
|
8
|
+
if ((0, types_1.isArray)(args[0])) {
|
|
9
9
|
const [strings, ...values] = args;
|
|
10
|
-
const name = concat_1.concat(strings, values).join('');
|
|
10
|
+
const name = (0, concat_1.concat)(strings, values).join('');
|
|
11
11
|
return (...matchers) => node(name, ...matchers);
|
|
12
12
|
}
|
|
13
|
-
if (types_1.isString(args[0])) {
|
|
13
|
+
if ((0, types_1.isString)(args[0])) {
|
|
14
14
|
const [name, ...matchers] = args;
|
|
15
15
|
return function (_node) {
|
|
16
16
|
const result = node(...matchers).call(this, _node);
|
|
17
17
|
if (result) {
|
|
18
|
-
|
|
18
|
+
(0, merge_in_place_1.mergeInPlace)(this.collection, { [name]: _node });
|
|
19
19
|
}
|
|
20
20
|
return result;
|
|
21
21
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../../src/matchers/node.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../../src/matchers/node.ts"],"names":[],"mappings":";;;AACA,6CAAqD;AACrD,0CAAsC;AACtC,0DAAoD;AAapD,SAAgB,IAAI,CAAC,GAAG,IAG6C;IAEnE,IAAI,IAAA,eAAO,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;QACpB,MAAM,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,GACxB,IAA4D,CAAA;QAC9D,MAAM,IAAI,GAAG,IAAA,eAAM,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAE7C,OAAO,CAAC,GAAG,QAA8D,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,QAAQ,CAAC,CAAA;KACtG;IAED,IAAI,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;QACrB,MAAM,CAAC,IAAI,EAAE,GAAG,QAAQ,CAAC,GACvB,IAAyF,CAAA;QAE3F,OAAO,UAAkC,KAAW;YAClD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;YAClD,IAAI,MAAM,EAAE;gBACV,IAAA,6BAAY,EAAC,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;aACjD;YACD,OAAO,MAAM,CAAA;QACf,CAAC,CAAA;KACF;IAED,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,IAA2E,CAAA;IAEjG,OAAO,UAAkC,IAAU;QACjD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAA;QAEtC,OAAO,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;IACxD,CAAC,CAAA;AACH,CAAC;AAjCD,oBAiCC"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.optional = void 0;
|
|
4
4
|
const multiple_1 = require("./multiple");
|
|
5
5
|
function optional(matcher) {
|
|
6
|
-
return multiple_1.multiple([0, 1], matcher, { greedy: true });
|
|
6
|
+
return (0, multiple_1.multiple)([0, 1], matcher, { greedy: true });
|
|
7
7
|
}
|
|
8
8
|
exports.optional = optional;
|
|
9
9
|
//# sourceMappingURL=optional.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optional.js","sourceRoot":"","sources":["../../../src/matchers/optional.ts"],"names":[],"mappings":";;;AACA,yCAAqC;AAErC,SAAgB,QAAQ,CAAiB,OAAgD;IACvF,OAAO,mBAAQ,
|
|
1
|
+
{"version":3,"file":"optional.js","sourceRoot":"","sources":["../../../src/matchers/optional.ts"],"names":[],"mappings":";;;AACA,yCAAqC;AAErC,SAAgB,QAAQ,CAAiB,OAAgD;IACvF,OAAO,IAAA,mBAAQ,EAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;AACpD,CAAC;AAFD,4BAEC"}
|
|
@@ -4,8 +4,8 @@ exports.repeat = void 0;
|
|
|
4
4
|
const errors_1 = require("@blackglory/errors");
|
|
5
5
|
const match_multiple_1 = require("../utils/match-multiple");
|
|
6
6
|
function repeat(times, matcher) {
|
|
7
|
-
errors_1.assert(Number.isInteger(times), 'parameter times must be an integer');
|
|
8
|
-
errors_1.assert(times >= 0, 'parameter number must be greater than or equal to 0');
|
|
7
|
+
(0, errors_1.assert)(Number.isInteger(times), 'parameter times must be an integer');
|
|
8
|
+
(0, errors_1.assert)(times >= 0, 'parameter number must be greater than or equal to 0');
|
|
9
9
|
return function (node) {
|
|
10
10
|
const result = match_multiple_1.matchMultiple.call(this, node, times, matcher);
|
|
11
11
|
if (result === times) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repeat.js","sourceRoot":"","sources":["../../../src/matchers/repeat.ts"],"names":[],"mappings":";;;AACA,+CAA2C;AAC3C,0DAAqD;AAErD,SAAgB,MAAM,CACpB,KAAa,EACb,OAAgD;IAEhD,eAAM,
|
|
1
|
+
{"version":3,"file":"repeat.js","sourceRoot":"","sources":["../../../src/matchers/repeat.ts"],"names":[],"mappings":";;;AACA,+CAA2C;AAC3C,0DAAqD;AAErD,SAAgB,MAAM,CACpB,KAAa,EACb,OAAgD;IAEhD,IAAA,eAAM,EAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,oCAAoC,CAAC,CAAA;IACrE,IAAA,eAAM,EAAC,KAAK,IAAI,CAAC,EAAE,qDAAqD,CAAC,CAAA;IAEzE,OAAO,UAAkC,IAAO;QAC9C,MAAM,MAAM,GAAG,8BAAa,CAAC,IAAI,CAC/B,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,OAAwD,CACzD,CAAA;QACD,IAAI,MAAM,KAAK,KAAK,EAAE;YACpB,OAAO,KAAK,CAAA;SACb;aAAM;YACL,OAAO,KAAK,CAAA;SACb;IACH,CAAC,CAAA;AACH,CAAC;AApBD,wBAoBC"}
|
|
@@ -4,7 +4,7 @@ exports.textContentEquals = void 0;
|
|
|
4
4
|
const types_1 = require("@blackglory/types");
|
|
5
5
|
function textContentEquals(text, { caseSensitive = true, trim = false } = {}) {
|
|
6
6
|
return (node) => {
|
|
7
|
-
if (types_1.isNull(node.textContent))
|
|
7
|
+
if ((0, types_1.isNull)(node.textContent))
|
|
8
8
|
return false;
|
|
9
9
|
let textContent = node.textContent;
|
|
10
10
|
if (!caseSensitive) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-content-equals.js","sourceRoot":"","sources":["../../../src/matchers/text-content-equals.ts"],"names":[],"mappings":";;;AACA,6CAA0C;AAO1C,SAAgB,iBAAiB,CAC/B,IAAY,EACZ,EACE,aAAa,GAAG,IAAI,EACpB,IAAI,GAAG,KAAK,KACiB,EAAE;IAEjC,OAAO,CAAC,IAAU,EAAE,EAAE;QACpB,IAAI,cAAM,
|
|
1
|
+
{"version":3,"file":"text-content-equals.js","sourceRoot":"","sources":["../../../src/matchers/text-content-equals.ts"],"names":[],"mappings":";;;AACA,6CAA0C;AAO1C,SAAgB,iBAAiB,CAC/B,IAAY,EACZ,EACE,aAAa,GAAG,IAAI,EACpB,IAAI,GAAG,KAAK,KACiB,EAAE;IAEjC,OAAO,CAAC,IAAU,EAAE,EAAE;QACpB,IAAI,IAAA,cAAM,EAAC,IAAI,CAAC,WAAW,CAAC;YAAE,OAAO,KAAK,CAAA;QAE1C,IAAI,WAAW,GAAG,IAAI,CAAC,WAAW,CAAA;QAClC,IAAI,CAAC,aAAa,EAAE;YAClB,WAAW,GAAG,WAAW,CAAC,WAAW,EAAE,CAAA;YACvC,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAA;SAC1B;QACD,IAAI,IAAI;YAAE,WAAW,GAAG,WAAW,CAAC,IAAI,EAAE,CAAA;QAE1C,OAAO,WAAW,KAAK,IAAI,CAAA;IAC7B,CAAC,CAAA;AACH,CAAC;AAnBD,8CAmBC"}
|
|
@@ -4,7 +4,7 @@ exports.textContentIncludes = void 0;
|
|
|
4
4
|
const types_1 = require("@blackglory/types");
|
|
5
5
|
function textContentIncludes(searchString, { caseSensitive = true, trim = false } = {}) {
|
|
6
6
|
return (node) => {
|
|
7
|
-
if (types_1.isNull(node.textContent))
|
|
7
|
+
if ((0, types_1.isNull)(node.textContent))
|
|
8
8
|
return false;
|
|
9
9
|
let textContent = node.textContent;
|
|
10
10
|
if (!caseSensitive) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-content-includes.js","sourceRoot":"","sources":["../../../src/matchers/text-content-includes.ts"],"names":[],"mappings":";;;AACA,6CAA0C;AAO1C,SAAgB,mBAAmB,CACjC,YAAoB,EACpB,EACE,aAAa,GAAG,IAAI,EACpB,IAAI,GAAG,KAAK,KACmB,EAAE;IAEnC,OAAO,CAAC,IAAU,EAAE,EAAE;QACpB,IAAI,cAAM,
|
|
1
|
+
{"version":3,"file":"text-content-includes.js","sourceRoot":"","sources":["../../../src/matchers/text-content-includes.ts"],"names":[],"mappings":";;;AACA,6CAA0C;AAO1C,SAAgB,mBAAmB,CACjC,YAAoB,EACpB,EACE,aAAa,GAAG,IAAI,EACpB,IAAI,GAAG,KAAK,KACmB,EAAE;IAEnC,OAAO,CAAC,IAAU,EAAE,EAAE;QACpB,IAAI,IAAA,cAAM,EAAC,IAAI,CAAC,WAAW,CAAC;YAAE,OAAO,KAAK,CAAA;QAE1C,IAAI,WAAW,GAAG,IAAI,CAAC,WAAW,CAAA;QAClC,IAAI,CAAC,aAAa,EAAE;YAClB,WAAW,GAAG,WAAW,CAAC,WAAW,EAAE,CAAA;YACvC,YAAY,GAAG,YAAY,CAAC,WAAW,EAAE,CAAA;SAC1C;QACD,IAAI,IAAI;YAAE,WAAW,GAAG,WAAW,CAAC,IAAI,EAAE,CAAA;QAE1C,OAAO,WAAW,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAA;IAC3C,CAAC,CAAA;AACH,CAAC;AAnBD,kDAmBC"}
|
|
@@ -4,7 +4,7 @@ exports.textContentMatches = void 0;
|
|
|
4
4
|
const types_1 = require("@blackglory/types");
|
|
5
5
|
function textContentMatches(pattern, { trim = false } = {}) {
|
|
6
6
|
return (node) => {
|
|
7
|
-
if (types_1.isNull(node.textContent))
|
|
7
|
+
if ((0, types_1.isNull)(node.textContent))
|
|
8
8
|
return false;
|
|
9
9
|
let textContent = node.textContent;
|
|
10
10
|
if (trim)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-content-matches.js","sourceRoot":"","sources":["../../../src/matchers/text-content-matches.ts"],"names":[],"mappings":";;;AACA,6CAA0C;AAM1C,SAAgB,kBAAkB,CAChC,OAAe,EACf,EAAE,IAAI,GAAG,KAAK,KAAiC,EAAE;IAEjD,OAAO,CAAC,IAAU,EAAE,EAAE;QACpB,IAAI,cAAM,
|
|
1
|
+
{"version":3,"file":"text-content-matches.js","sourceRoot":"","sources":["../../../src/matchers/text-content-matches.ts"],"names":[],"mappings":";;;AACA,6CAA0C;AAM1C,SAAgB,kBAAkB,CAChC,OAAe,EACf,EAAE,IAAI,GAAG,KAAK,KAAiC,EAAE;IAEjD,OAAO,CAAC,IAAU,EAAE,EAAE;QACpB,IAAI,IAAA,cAAM,EAAC,IAAI,CAAC,WAAW,CAAC;YAAE,OAAO,KAAK,CAAA;QAE1C,IAAI,WAAW,GAAG,IAAI,CAAC,WAAW,CAAA;QAClC,IAAI,IAAI;YAAE,WAAW,GAAG,WAAW,CAAC,IAAI,EAAE,CAAA;QAE1C,OAAO,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;IAClC,CAAC,CAAA;AACH,CAAC;AAZD,gDAYC"}
|
|
@@ -4,26 +4,26 @@ exports.textNode = void 0;
|
|
|
4
4
|
const types_1 = require("@blackglory/types");
|
|
5
5
|
const concat_1 = require("../utils/concat");
|
|
6
6
|
const extra_dom_1 = require("extra-dom");
|
|
7
|
-
const
|
|
7
|
+
const merge_in_place_1 = require("../utils/merge-in-place");
|
|
8
8
|
function textNode(...args) {
|
|
9
|
-
if (
|
|
9
|
+
if ((0, types_1.isArray)(args[0])) {
|
|
10
10
|
const [strings, ...values] = args;
|
|
11
|
-
const name = concat_1.concat(strings, values).join('');
|
|
11
|
+
const name = (0, concat_1.concat)(strings, values).join('');
|
|
12
12
|
return (...matchers) => textNode(name, ...matchers);
|
|
13
13
|
}
|
|
14
|
-
if (types_1.isString(args[0])) {
|
|
14
|
+
if ((0, types_1.isString)(args[0])) {
|
|
15
15
|
const [name, ...matchers] = args;
|
|
16
16
|
return function (node) {
|
|
17
17
|
const result = textNode(...matchers).call(this, node);
|
|
18
18
|
if (result) {
|
|
19
|
-
|
|
19
|
+
(0, merge_in_place_1.mergeInPlace)(this.collection, { [name]: node });
|
|
20
20
|
}
|
|
21
21
|
return result;
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
const [...matchers] = args;
|
|
25
25
|
return function (node) {
|
|
26
|
-
if (extra_dom_1.isntTextNode(node))
|
|
26
|
+
if ((0, extra_dom_1.isntTextNode)(node))
|
|
27
27
|
return false;
|
|
28
28
|
if (matchers.length === 0)
|
|
29
29
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-node.js","sourceRoot":"","sources":["../../../src/matchers/text-node.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"text-node.js","sourceRoot":"","sources":["../../../src/matchers/text-node.ts"],"names":[],"mappings":";;;AACA,6CAAqD;AACrD,0CAAsC;AACtC,yCAAwC;AACxC,0DAAoD;AAapD,SAAgB,QAAQ,CAAC,GAAG,IAGkB;IAE5C,IAAI,IAAA,eAAO,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;QACpB,MAAM,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,GACxB,IAA4D,CAAA;QAC9D,MAAM,IAAI,GAAG,IAAA,eAAM,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAE7C,OAAO,CAAC,GAAG,QAAuC,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,QAAQ,CAAC,CAAA;KACnF;IAED,IAAI,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;QACrB,MAAM,CAAC,IAAI,EAAE,GAAG,QAAQ,CAAC,GACvB,IAAkE,CAAA;QAEpE,OAAO,UAAkC,IAAU;YACjD,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;YACrD,IAAI,MAAM,EAAE;gBACV,IAAA,6BAAY,EAAC,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;aAChD;YACD,OAAO,MAAM,CAAA;QACf,CAAC,CAAA;KACF;IAED,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,IAAoD,CAAA;IAE1E,OAAO,UAAkC,IAAU;QACjD,IAAI,IAAA,wBAAY,EAAC,IAAI,CAAC;YAAE,OAAO,KAAK,CAAA;QACpC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAA;QAEtC,OAAO,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;IACxD,CAAC,CAAA;AACH,CAAC;AAlCD,4BAkCC"}
|
|
@@ -8,16 +8,16 @@ const UNORDERED_NODE_ITERATOR_TYPE = 'XPathResult' in globalThis
|
|
|
8
8
|
? XPathResult.UNORDERED_NODE_ITERATOR_TYPE
|
|
9
9
|
: 4;
|
|
10
10
|
function xpath(...args) {
|
|
11
|
-
if (types_1.isString(args[0])) {
|
|
11
|
+
if ((0, types_1.isString)(args[0])) {
|
|
12
12
|
const [expression] = args;
|
|
13
|
-
errors_1.assert(expression.startsWith('//*'), 'XPath expressions must start with "//*"');
|
|
13
|
+
(0, errors_1.assert)(expression.startsWith('//*'), 'XPath expressions must start with "//*"');
|
|
14
14
|
return function (node) {
|
|
15
15
|
return xpathMatches(this.document, expression, node);
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
else {
|
|
19
19
|
const [strings, ...values] = args;
|
|
20
|
-
const expression = concat_1.concat(strings, values).join('');
|
|
20
|
+
const expression = (0, concat_1.concat)(strings, values).join('');
|
|
21
21
|
return xpath(expression);
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xpath.js","sourceRoot":"","sources":["../../../src/matchers/xpath.ts"],"names":[],"mappings":";;;AACA,6CAA4C;AAC5C,0CAAsC;AACtC,+CAA2C;AAE3C,MAAM,4BAA4B,GAChC,aAAa,IAAI,UAAU;IAC3B,CAAC,CAAC,WAAW,CAAC,4BAA4B;IAC1C,CAAC,CAAC,CAAC,CAAA;AASL,SAAgB,KAAK,CAAC,GAAG,IAE6B;IAEpD,IAAI,gBAAQ,
|
|
1
|
+
{"version":3,"file":"xpath.js","sourceRoot":"","sources":["../../../src/matchers/xpath.ts"],"names":[],"mappings":";;;AACA,6CAA4C;AAC5C,0CAAsC;AACtC,+CAA2C;AAE3C,MAAM,4BAA4B,GAChC,aAAa,IAAI,UAAU;IAC3B,CAAC,CAAC,WAAW,CAAC,4BAA4B;IAC1C,CAAC,CAAC,CAAC,CAAA;AASL,SAAgB,KAAK,CAAC,GAAG,IAE6B;IAEpD,IAAI,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;QACrB,MAAM,CAAC,UAAU,CAAC,GAAG,IAAI,CAAA;QACzB,IAAA,eAAM,EAAC,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,yCAAyC,CAAC,CAAA;QAE/E,OAAO,UAEL,IAAU;YAEV,OAAO,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,CAAC,CAAA;QACtD,CAAC,CAAA;KACF;SAAM;QACL,MAAM,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,GAAG,IAAI,CAAA;QACjC,MAAM,UAAU,GAAG,IAAA,eAAM,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAEnD,OAAO,KAAK,CAAC,UAAU,CAAC,CAAA;KACzB;AACH,CAAC;AApBD,sBAoBC;AAED,SAAS,YAAY,CAAC,QAAkB,EAAE,UAAkB,EAAE,IAAU;IACtE,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAChC,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,4BAA4B,EAC5B,IAAI,CACL,CAAA;IAED,IAAI,KAAK,CAAA;IACT,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC,KAAK,IAAI,EAAE;QAChD,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO,IAAI,CAAA;KAChC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
|
|
@@ -4,7 +4,7 @@ exports.matchMultiple = void 0;
|
|
|
4
4
|
const extra_generator_1 = require("extra-generator");
|
|
5
5
|
function matchMultiple(node, ubound, matcher) {
|
|
6
6
|
let currentNode = node;
|
|
7
|
-
for (const round of extra_generator_1.countup(1, ubound)) {
|
|
7
|
+
for (const round of (0, extra_generator_1.countup)(1, ubound)) {
|
|
8
8
|
if (!currentNode)
|
|
9
9
|
return round - 1;
|
|
10
10
|
const result = matcher.call(this, currentNode);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match-multiple.js","sourceRoot":"","sources":["../../../src/utils/match-multiple.ts"],"names":[],"mappings":";;;AAAA,qDAAyC;AAMzC,SAAgB,aAAa,CAE3B,IAAO,EACP,MAAc,EACd,OAAgD;IAEhD,IAAI,WAAW,GAAa,IAAI,CAAA;IAEhC,KAAK,MAAM,KAAK,IAAI,yBAAO,
|
|
1
|
+
{"version":3,"file":"match-multiple.js","sourceRoot":"","sources":["../../../src/utils/match-multiple.ts"],"names":[],"mappings":";;;AAAA,qDAAyC;AAMzC,SAAgB,aAAa,CAE3B,IAAO,EACP,MAAc,EACd,OAAgD;IAEhD,IAAI,WAAW,GAAa,IAAI,CAAA;IAEhC,KAAK,MAAM,KAAK,IAAI,IAAA,yBAAO,EAAC,CAAC,EAAE,MAAM,CAAC,EAAE;QACtC,IAAI,CAAC,WAAW;YAAE,OAAO,KAAK,GAAG,CAAC,CAAA;QAElC,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;QAC9C,IAAI,MAAM,EAAE;YACV,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,CAAa,CAAA;SACjD;aAAM;YACL,OAAO,KAAK,GAAG,CAAC,CAAA;SACjB;KACF;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AApBD,sCAoBC"}
|
|
@@ -9,7 +9,7 @@ function matchOneByOne(context, source, ...matchers) {
|
|
|
9
9
|
return false;
|
|
10
10
|
const [matcher, ...otherMatchers] = matchers;
|
|
11
11
|
const result = Reflect.apply(matcher, context, [source]);
|
|
12
|
-
if (types_1.isBoolean(result)) {
|
|
12
|
+
if ((0, types_1.isBoolean)(result)) {
|
|
13
13
|
if (result) {
|
|
14
14
|
const nextNode = context.next(source);
|
|
15
15
|
return matchOneByOne(context, nextNode, ...otherMatchers);
|
|
@@ -18,12 +18,12 @@ function matchOneByOne(context, source, ...matchers) {
|
|
|
18
18
|
return false;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
if (types_1.isNumber(result)) {
|
|
21
|
+
if ((0, types_1.isNumber)(result)) {
|
|
22
22
|
const distance = result;
|
|
23
23
|
const nextNode = context.next(source, distance);
|
|
24
24
|
return matchOneByOne(context, nextNode, ...otherMatchers);
|
|
25
25
|
}
|
|
26
|
-
if (types_1.isIterable(result)) {
|
|
26
|
+
if ((0, types_1.isIterable)(result)) {
|
|
27
27
|
for (const distance of result) {
|
|
28
28
|
const nextNode = context.next(source, distance);
|
|
29
29
|
if (matchOneByOne(context, nextNode, ...otherMatchers)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match-one-by-one.js","sourceRoot":"","sources":["../../../src/utils/match-one-by-one.ts"],"names":[],"mappings":";;;AACA,6CAAmE;AAEnE,SAAgB,aAAa,CAC3B,OAAyB,EACzB,MAAgB,EAChB,GAAG,QAA4B;IAE/B,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IACtC,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAA;IAEzB,MAAM,CAAC,OAAO,EAAE,GAAG,aAAa,CAAC,GAAG,QAAQ,CAAA;IAE5C,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,MAAM,CAAC,CAA+B,CAAA;IAGtF,IAAI,iBAAS,
|
|
1
|
+
{"version":3,"file":"match-one-by-one.js","sourceRoot":"","sources":["../../../src/utils/match-one-by-one.ts"],"names":[],"mappings":";;;AACA,6CAAmE;AAEnE,SAAgB,aAAa,CAC3B,OAAyB,EACzB,MAAgB,EAChB,GAAG,QAA4B;IAE/B,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IACtC,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAA;IAEzB,MAAM,CAAC,OAAO,EAAE,GAAG,aAAa,CAAC,GAAG,QAAQ,CAAA;IAE5C,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,MAAM,CAAC,CAA+B,CAAA;IAGtF,IAAI,IAAA,iBAAS,EAAC,MAAM,CAAC,EAAE;QACrB,IAAI,MAAM,EAAE;YACV,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAa,CAAA;YACjD,OAAO,aAAa,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,aAAa,CAAC,CAAA;SAC1D;aAAM;YACL,OAAO,KAAK,CAAA;SACb;KACF;IAGD,IAAI,IAAA,gBAAQ,EAAC,MAAM,CAAC,EAAE;QACpB,MAAM,QAAQ,GAAG,MAAM,CAAA;QACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAa,CAAA;QAC3D,OAAO,aAAa,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,aAAa,CAAC,CAAA;KAC1D;IAGD,IAAI,IAAA,kBAAU,EAAC,MAAM,CAAC,EAAE;QACtB,KAAK,MAAM,QAAQ,IAAI,MAAM,EAAE;YAC7B,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAa,CAAA;YAC3D,IAAI,aAAa,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,aAAa,CAAC,EAAE;gBACtD,OAAO,IAAI,CAAA;aACZ;SACF;QAGD,OAAO,KAAK,CAAA;KACb;IAED,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAA;AACzC,CAAC;AA3CD,sCA2CC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
3
|
+
exports.mergeInPlace = void 0;
|
|
4
|
+
const types_1 = require("@blackglory/types");
|
|
5
|
+
function mergeInPlace(target, source) {
|
|
5
6
|
for (const [key, value] of Object.entries(source)) {
|
|
6
7
|
if (target[key]) {
|
|
7
|
-
if (
|
|
8
|
-
if (
|
|
8
|
+
if ((0, types_1.isArray)(target[key])) {
|
|
9
|
+
if ((0, types_1.isArray)(value)) {
|
|
9
10
|
target[key] = [...target[key], ...value];
|
|
10
11
|
}
|
|
11
12
|
else {
|
|
@@ -13,7 +14,7 @@ function merge(target, source) {
|
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
else {
|
|
16
|
-
if (
|
|
17
|
+
if ((0, types_1.isArray)(value)) {
|
|
17
18
|
target[key] = [target[key], ...value];
|
|
18
19
|
}
|
|
19
20
|
else {
|
|
@@ -26,5 +27,5 @@ function merge(target, source) {
|
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
|
-
exports.
|
|
30
|
-
//# sourceMappingURL=merge.js.map
|
|
30
|
+
exports.mergeInPlace = mergeInPlace;
|
|
31
|
+
//# sourceMappingURL=merge-in-place.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-in-place.js","sourceRoot":"","sources":["../../../src/utils/merge-in-place.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAE3C,SAAgB,YAAY,CAC1B,MAAkC,EAClC,MAAkC;IAElC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACjD,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE;YACf,IAAI,IAAA,eAAO,EAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE;gBACxB,IAAI,IAAA,eAAO,EAAC,KAAK,CAAC,EAAE;oBAClB,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAQ,EAAE,GAAG,KAAK,CAAC,CAAA;iBAChD;qBAAM;oBACL,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAQ,EAAE,KAAK,CAAC,CAAA;iBAC7C;aACF;iBAAM;gBACL,IAAI,IAAA,eAAO,EAAC,KAAK,CAAC,EAAE;oBAClB,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAM,EAAE,GAAG,KAAK,CAAC,CAAA;iBAC3C;qBAAM;oBACL,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAM,EAAE,KAAK,CAAC,CAAA;iBACxC;aACF;SACF;aAAM;YACL,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;SACpB;KACF;AACH,CAAC;AAvBD,oCAuBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blackglory/match",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "A module for matching nodes from pages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"query",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"repository": "git@github.com:BlackGlory/match.git",
|
|
17
17
|
"author": "BlackGlory <woshenmedoubuzhidao@blackglory.me>",
|
|
18
18
|
"license": "MIT",
|
|
19
|
+
"sideEffects": false,
|
|
19
20
|
"scripts": {
|
|
20
21
|
"lint": "eslint --ext .js,.jsx,.ts,.tsx --quiet src __tests__",
|
|
21
22
|
"test": "jest --config jest.config.js",
|
|
@@ -41,39 +42,38 @@
|
|
|
41
42
|
}
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
|
-
"@blackglory/jest-matchers": "^0.1
|
|
45
|
-
"@commitlint/cli": "^
|
|
46
|
-
"@commitlint/config-conventional": "^
|
|
47
|
-
"@rollup/plugin-commonjs": "^
|
|
45
|
+
"@blackglory/jest-matchers": "^0.2.1",
|
|
46
|
+
"@commitlint/cli": "^15.0.0",
|
|
47
|
+
"@commitlint/config-conventional": "^15.0.0",
|
|
48
|
+
"@rollup/plugin-commonjs": "^21.0.1",
|
|
48
49
|
"@rollup/plugin-json": "^4.1.0",
|
|
49
|
-
"@rollup/plugin-node-resolve": "^13.0.
|
|
50
|
-
"@rollup/plugin-replace": "^
|
|
51
|
-
"@rollup/plugin-typescript": "^8.
|
|
52
|
-
"@types/jest": "^
|
|
50
|
+
"@rollup/plugin-node-resolve": "^13.0.6",
|
|
51
|
+
"@rollup/plugin-replace": "^3.0.0",
|
|
52
|
+
"@rollup/plugin-typescript": "^8.3.0",
|
|
53
|
+
"@types/jest": "^27.0.3",
|
|
53
54
|
"@types/jsdom": "^16.2.13",
|
|
54
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
55
|
-
"@typescript-eslint/parser": "^
|
|
56
|
-
"eslint": "^
|
|
55
|
+
"@typescript-eslint/eslint-plugin": "^5.6.0",
|
|
56
|
+
"@typescript-eslint/parser": "^5.6.0",
|
|
57
|
+
"eslint": "^8.4.1",
|
|
57
58
|
"husky": "^4.3.8",
|
|
58
|
-
"iterable-operator": "^0.14.
|
|
59
|
-
"jest": "^27.
|
|
60
|
-
"
|
|
61
|
-
"jsdom": "^16.6.0",
|
|
59
|
+
"iterable-operator": "^0.14.4",
|
|
60
|
+
"jest": "^27.4.4",
|
|
61
|
+
"jsdom": "^19.0.0",
|
|
62
62
|
"npm-run-all": "^4.1.5",
|
|
63
63
|
"rimraf": "^3.0.2",
|
|
64
|
-
"rollup": "^2.
|
|
64
|
+
"rollup": "^2.61.1",
|
|
65
65
|
"rollup-plugin-analyzer": "^4.0.0",
|
|
66
66
|
"rollup-plugin-terser": "^7.0.2",
|
|
67
|
-
"standard-version": "^9.3.
|
|
68
|
-
"ts-jest": "^27.
|
|
67
|
+
"standard-version": "^9.3.2",
|
|
68
|
+
"ts-jest": "^27.1.1",
|
|
69
69
|
"tscpaths": "^0.0.9",
|
|
70
|
-
"tslib": "^2.3.
|
|
71
|
-
"typescript": "^4.3
|
|
70
|
+
"tslib": "^2.3.1",
|
|
71
|
+
"typescript": "^4.5.3"
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
74
|
"@blackglory/errors": "^1.1.2",
|
|
75
|
-
"@blackglory/types": "^0.
|
|
76
|
-
"extra-dom": "^0.4.
|
|
77
|
-
"extra-generator": "^0.2.
|
|
75
|
+
"@blackglory/types": "^0.5.2",
|
|
76
|
+
"extra-dom": "^0.4.4",
|
|
77
|
+
"extra-generator": "^0.2.15"
|
|
78
78
|
}
|
|
79
79
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
-
|
|
5
|
-
### [0.3.2](https://github.com/BlackGlory/match/compare/v0.3.1...v0.3.2) (2021-07-13)
|
|
6
|
-
|
|
7
|
-
### [0.3.1](https://github.com/BlackGlory/match/compare/v0.3.0...v0.3.1) (2021-07-03)
|
|
8
|
-
|
|
9
|
-
## [0.3.0](https://github.com/BlackGlory/match/compare/v0.2.4...v0.3.0) (2021-05-16)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
### ⚠ BREAKING CHANGES
|
|
13
|
-
|
|
14
|
-
* interfaces changed
|
|
15
|
-
|
|
16
|
-
### Features
|
|
17
|
-
|
|
18
|
-
* modify interfaces ([c18a41c](https://github.com/BlackGlory/match/commit/c18a41c4257da07387df550711415a5b8afb7bd4))
|
|
19
|
-
|
|
20
|
-
### [0.2.4](https://github.com/BlackGlory/match/compare/v0.2.3...v0.2.4) (2021-05-16)
|
|
21
|
-
|
|
22
|
-
### [0.2.3](https://github.com/BlackGlory/match/compare/v0.2.2...v0.2.3) (2021-05-16)
|
|
23
|
-
|
|
24
|
-
### [0.2.2](https://github.com/BlackGlory/match/compare/v0.2.1...v0.2.2) (2021-05-07)
|
|
25
|
-
|
|
26
|
-
### [0.2.1](https://github.com/BlackGlory/match/compare/v0.2.0...v0.2.1) (2021-04-21)
|
|
27
|
-
|
|
28
|
-
## [0.2.0](https://github.com/BlackGlory/match/compare/v0.1.3...v0.2.0) (2021-04-06)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
### ⚠ BREAKING CHANGES
|
|
32
|
-
|
|
33
|
-
* the signature of `multiple` changed.
|
|
34
|
-
|
|
35
|
-
### Features
|
|
36
|
-
|
|
37
|
-
* split `multiple` ([487c835](https://github.com/BlackGlory/match/commit/487c83535cd6fdbec7a53cb9ab05937e180ae729))
|
|
38
|
-
|
|
39
|
-
### [0.1.3](https://github.com/BlackGlory/match/compare/v0.1.2...v0.1.3) (2021-04-06)
|
|
40
|
-
|
|
41
|
-
### [0.1.2](https://github.com/BlackGlory/match/compare/v0.1.1...v0.1.2) (2021-04-06)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
### Features
|
|
45
|
-
|
|
46
|
-
* add tap ([b76c5d1](https://github.com/BlackGlory/match/commit/b76c5d1de0df6134ca1fd5a6be26a0fbc792e3a3))
|
|
47
|
-
|
|
48
|
-
### [0.1.1](https://github.com/BlackGlory/match/compare/v0.1.0...v0.1.1) (2021-04-05)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
### Features
|
|
52
|
-
|
|
53
|
-
* add options `trim` ([2405dad](https://github.com/BlackGlory/match/commit/2405dad31782c498adba7c299fc9b784c038dca6))
|
|
54
|
-
|
|
55
|
-
## 0.1.0 (2021-04-05)
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
### Features
|
|
59
|
-
|
|
60
|
-
* init ([991b61e](https://github.com/BlackGlory/match/commit/991b61e0347bab67dc59ab61bec6be990768640e))
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../../../src/utils/merge.ts"],"names":[],"mappings":";;;AAAA,SAAgB,KAAK,CACnB,MAAkC,EAClC,MAAkC;IAElC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACjD,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE;YACf,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE;gBAC9B,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;oBACxB,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAQ,EAAE,GAAG,KAAK,CAAC,CAAA;iBAChD;qBAAM;oBACL,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAQ,EAAE,KAAK,CAAC,CAAA;iBAC7C;aACF;iBAAM;gBACL,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;oBACxB,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAM,EAAE,GAAG,KAAK,CAAC,CAAA;iBAC3C;qBAAM;oBACL,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAM,EAAE,KAAK,CAAC,CAAA;iBACxC;aACF;SACF;aAAM;YACL,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;SACpB;KACF;AACH,CAAC;AAvBD,sBAuBC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../../../src/utils/merge.ts"],"names":[],"mappings":";;;AAAA,SAAgB,KAAK,CACnB,MAAkC,EAClC,MAAkC;IAElC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACjD,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE;YACf,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE;gBAC9B,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;oBACxB,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAQ,EAAE,GAAG,KAAK,CAAC,CAAA;iBAChD;qBAAM;oBACL,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAQ,EAAE,KAAK,CAAC,CAAA;iBAC7C;aACF;iBAAM;gBACL,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;oBACxB,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAM,EAAE,GAAG,KAAK,CAAC,CAAA;iBAC3C;qBAAM;oBACL,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAM,EAAE,KAAK,CAAC,CAAA;iBACxC;aACF;SACF;aAAM;YACL,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;SACpB;KACF;AACH,CAAC;AAvBD,sBAuBC"}
|