"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;