guessit-js 4.5.1 → 4.5.2
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/README.md +3 -3
- package/dist/guessit-js.cjs +15 -10
- package/dist/guessit-js.cjs.map +1 -1
- package/dist/guessit-js.js +15 -10
- package/dist/guessit-js.js.map +1 -1
- package/package.json +2 -2
package/dist/guessit-js.js
CHANGED
|
@@ -370,6 +370,11 @@ class _BaseMatches {
|
|
|
370
370
|
toArray() {
|
|
371
371
|
return [...this._delegate];
|
|
372
372
|
}
|
|
373
|
+
/** All matches as an array. Ported Python code reads `matches.matches` — without
|
|
374
|
+
* this getter that silently evaluated to undefined and turned rules into no-ops. */
|
|
375
|
+
get matches() {
|
|
376
|
+
return [...this._delegate];
|
|
377
|
+
}
|
|
373
378
|
// ── Cache accessors ──────────────────────────────────────────────────────
|
|
374
379
|
get nameDict() {
|
|
375
380
|
if (!this._nameDict) {
|
|
@@ -1619,12 +1624,10 @@ function executeRule(rule, matches, context) {
|
|
|
1619
1624
|
}
|
|
1620
1625
|
function toposortRules(rules) {
|
|
1621
1626
|
const graph = /* @__PURE__ */ new Map();
|
|
1622
|
-
const
|
|
1627
|
+
const classToDeps = /* @__PURE__ */ new Map();
|
|
1623
1628
|
for (const rule of rules) {
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
}
|
|
1627
|
-
classToDep.set(rule.constructor, rule);
|
|
1629
|
+
const cls = rule.constructor;
|
|
1630
|
+
classToDeps.set(cls, [...classToDeps.get(cls) ?? [], rule]);
|
|
1628
1631
|
}
|
|
1629
1632
|
for (const rule of rules) {
|
|
1630
1633
|
const deps = /* @__PURE__ */ new Set();
|
|
@@ -1632,18 +1635,20 @@ function toposortRules(rules) {
|
|
|
1632
1635
|
if (rawDeps) {
|
|
1633
1636
|
const depArr = Array.isArray(rawDeps) ? rawDeps : [rawDeps];
|
|
1634
1637
|
for (const dep of depArr) {
|
|
1635
|
-
let resolved;
|
|
1638
|
+
let resolved = [];
|
|
1636
1639
|
if (typeof dep === "string") {
|
|
1637
|
-
for (const [cls,
|
|
1640
|
+
for (const [cls, insts] of classToDeps) {
|
|
1638
1641
|
if (cls.name === dep) {
|
|
1639
|
-
resolved =
|
|
1642
|
+
resolved = insts;
|
|
1640
1643
|
break;
|
|
1641
1644
|
}
|
|
1642
1645
|
}
|
|
1643
1646
|
} else {
|
|
1644
|
-
resolved =
|
|
1647
|
+
resolved = classToDeps.get(dep) ?? [];
|
|
1648
|
+
}
|
|
1649
|
+
for (const inst of resolved) {
|
|
1650
|
+
if (inst !== rule) deps.add(inst);
|
|
1645
1651
|
}
|
|
1646
|
-
if (resolved) deps.add(resolved);
|
|
1647
1652
|
}
|
|
1648
1653
|
}
|
|
1649
1654
|
graph.set(rule, deps);
|