PHP WebShell
Текущая директория: /usr/lib/node_modules/bitgo/node_modules/@celo/base/lib
Просмотр файла: inputValidation.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateDecimal = exports.validateInteger = exports.ValidatorKind = void 0;
var ValidatorKind;
(function (ValidatorKind) {
ValidatorKind["Custom"] = "custom";
ValidatorKind["Decimal"] = "decimal";
ValidatorKind["Integer"] = "integer";
ValidatorKind["Phone"] = "phone";
})(ValidatorKind = exports.ValidatorKind || (exports.ValidatorKind = {}));
function validateInteger(input) {
return input.replace(/[^0-9]/g, '');
}
exports.validateInteger = validateInteger;
function validateDecimal(input, decimalSeparator) {
if (decimalSeparator === void 0) { decimalSeparator = '.'; }
var regex = decimalSeparator === ',' ? /[^0-9,]/g : /[^0-9.]/g;
var cleanedArray = input.replace(regex, '').split(decimalSeparator);
if (cleanedArray.length <= 1) {
// Empty string or no decimals
return cleanedArray.join('');
}
else {
return cleanedArray.shift() + decimalSeparator + cleanedArray.join('');
}
}
exports.validateDecimal = validateDecimal;
//# sourceMappingURL=inputValidation.js.mapВыполнить команду
Для локальной разработки. Не используйте в интернете!