@labdigital/commercetools-mock 2.53.0 → 2.53.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -4600,6 +4600,7 @@ const resolveSymbol = (val, vars) => {
|
|
|
4600
4600
|
};
|
|
4601
4601
|
const resolveValue = (obj, val) => {
|
|
4602
4602
|
if (val.type !== "identifier") throw new PredicateError("Internal error");
|
|
4603
|
+
if (val.value === "variants" && obj.masterVariant && obj.variants !== void 0) return [obj.masterVariant, ...obj.variants ?? []];
|
|
4603
4604
|
if (!(val.value in obj)) {
|
|
4604
4605
|
if (Array.isArray(obj)) return Object.values(obj).filter((v) => val.value in v).map((v) => v[val.value]);
|
|
4605
4606
|
return void 0;
|
|
@@ -4645,7 +4646,7 @@ const generateMatchFunc = (predicate) => {
|
|
|
4645
4646
|
return (obj) => !expr(obj);
|
|
4646
4647
|
}).nud("EMPTY", 10, ({ bp }) => "empty").nud("DEFINED", 10, ({ bp }) => "defined").led("AND", 5, ({ left, bp }) => {
|
|
4647
4648
|
const expr = parser.parse({ terminals: [bp - 1] });
|
|
4648
|
-
return (obj) => left(obj) && expr(obj);
|
|
4649
|
+
return (obj, vars) => left(obj, vars) && expr(obj, vars);
|
|
4649
4650
|
}).led("OR", 5, ({ left, token, bp }) => {
|
|
4650
4651
|
const expr = parser.parse({ terminals: [bp - 1] });
|
|
4651
4652
|
return (obj, vars) => left(obj, vars) || expr(obj, vars);
|