tweak-tools
Version:
Tweak your React projects until awesomeness
23 lines (22 loc) • 776 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.normalize = exports.sanitize = exports.schema = void 0;
const v8n_1 = __importDefault(require("v8n"));
const schema = (o) => (0, v8n_1.default)().string().test(o);
exports.schema = schema;
const sanitize = (v) => {
if (typeof v !== 'string')
throw Error(`Invalid string`);
return v;
};
exports.sanitize = sanitize;
const normalize = ({ value, editable = true, rows = false }) => {
return {
value,
settings: { editable, rows: typeof rows === 'number' ? rows : rows ? 5 : 0 },
};
};
exports.normalize = normalize;