UNPKG

@inkline/inkline

Version:

Inkline is the intuitive UI Components library that gives you a developer-friendly foundation for building high-quality, accessible, and customizable Vue.js 3 Design Systems.

21 lines (20 loc) 522 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.number = void 0; const number = (value, options) => { let regExpString = "\\d+"; if (options.allowNegative) { regExpString = "[-]?" + regExpString; } if (options.allowDecimal) { regExpString += "([\\.\\,]\\d+)?"; } const regExp = new RegExp(`^${regExpString}$`); if (value?.constructor === Array) { return value.every(v => regExp.test(v)); } return regExp.test(String(value)); }; exports.number = number;