- return defineOwnProperties(
- setPrototype(this, matcherPrototype),
- {
- lastIndex: {
- configurable: false,
- enumerable: false,
- value: 0,
- writable: false,
- },
- name: {
- value: name != null
- ? `${name}`
- : `Matcher(${call(reToString, regExp, [])})`,
+ if (constraint !== null && typeof constraint !== "function") {
+ throw new TypeError(
+ "Piscēs: Cannot construct Matcher: Constraint is not callable.",
+ );
+ } else {
+ this.#constraint = constraint;
+ return defineOwnProperties(
+ setPrototype(this, matcherPrototype),
+ {
+ lastIndex: {
+ configurable: false,
+ enumerable: false,
+ value: 0,
+ writable: false,
+ },
+ name: {
+ value: name != null
+ ? `${name}`
+ : `Matcher(${call(reToString, regExp, [])})`,
+ },