@bemedev/basifun
Version:
Basic ts functions
23 lines (21 loc) • 609 B
JavaScript
const minLength = (min, value) => {
return minLength.normal(min, value);
};
minLength.checker = (min, value) => value.length > min;
minLength.low = (min, value) => {
const bool = minLength.checker(min, value);
return {
bool,
value,
};
};
minLength.normal = (min, _value) => {
const { bool, value } = minLength.low(min, _value);
if (!bool)
throw new Error(`"${value}" is shorter or equal than ${min}`);
return value;
};
minLength.strict = minLength.normal;
minLength.strictest = minLength.strict;
export { minLength };
//# sourceMappingURL=minLength.js.map