swc/crates/swc_ecma_minifier/tests/full/next-30498/1/input.js
Donny/강동윤 df635c9e6d
fix(es/minifier): Fix minifier (#2711)
swc_ecma_minifier:
 - Respect `inline_prevented`.
 - Mark the LHS of an assignment pattern property as a pattern. (https://github.com/vercel/next.js/issues/30498)
2021-11-10 20:56:50 +09:00

34 lines
865 B
JavaScript

function string_create() {
return new StringSchema();
}
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;