swc/crates/swc_ecma_minifier/tests/full/next-30498/1/input.js

32 lines
856 B
JavaScript

export function string_create() {
return new StringSchema();
}
export class StringSchema extends BaseSchema {
matches(regex, options) {
let excludeEmptyString = false;
let message;
let name;
if (options) {
if (typeof options === "object") {
({ excludeEmptyString = false, message, name } = options);
} else {
message = options;
}
}
return this.test({
name: name || "matches",
message: message || string.matches,
params: {
regex,
},
test: (value) =>
isAbsent(value) ||
(value === "" && excludeEmptyString) ||
value.search(regex) !== -1,
});
}
}
string_create.prototype = StringSchema.prototype;