UNPKG

@bemedev/basifun

Version:
23 lines (21 loc) 653 B
const exactLength = (exact, value) => { return exactLength.normal(exact, value); }; exactLength.checker = (exact, value) => value.length === exact; exactLength.low = (exact, value) => { const bool = exactLength.checker(exact, value); return { bool, value, }; }; exactLength.normal = (exact, _value) => { const { bool, value } = exactLength.low(exact, _value); if (!bool) throw new Error(`"${value}".length is not equal to ${exact}`); return value; }; exactLength.strict = exactLength.normal; exactLength.strictest = exactLength.strict; export { exactLength }; //# sourceMappingURL=exactLength.js.map