Change merge strategy of descriptors, when using named descriptors
At this line the Object.assign
is used to add properties of the named descriptor (if found) to the resulting one. This was OK when descriptors were objects with a flat property structure, but with the introduction of composite
validator (see #15 (closed)) this doesn't work correctly: if both descriptors have composite
validator, the one that's provided earlier is lost:
const compositeFirst = {
value: {
kind: "primitive-non-void",
typeOf: "number",
},
};
const compositeSecond = {
value: {
set: [ 2, 3 ],
},
};
valuer.define(":digit", { composite: compositeFirst });
valuer.define(":two-or-three", { composite: compositeSecond });
valuer.as(":digit", ":two-or-three");
// (descriptor).composite === compositeSecond