Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
ui-component-library / dist / forms / deps / isAlphaNumeric.js
Size: Mime:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// import { isNumberOrString } from 'exotic'
const exotic_1 = require("exotic");
const isNumberOrString = x => exotic_1.isNumber(x) || exotic_1.isString(x);
// @note - this old credit card match does global match
// and has no begin/end so it will trigger falsy
// /[a-zA-Z0-9]/g
const matchLetters = /([a-zA-Z])/;
exports.matchLetters = matchLetters;
const matchNumbers = /([0-9])/;
exports.matchNumbers = matchNumbers;
const matchAlphaNumeric = /^[A-Za-z0-9]+$/;
const onlyAlphabets = /^[a-zA-Z]*$/;
const matchCity = /^[A-Za-z -]*$/;
/**
 * @alias isNumberOrStringOnly
 * @name isAlphaNumeric
 *
 * @description has only numbers & letters
 * @param {String | Number} value
 * @return {Boolean} is valid
 */
function isAlphaNumeric(value) {
    return isNumberOrString(value) && matchAlphaNumeric.test(value);
}
exports.isAlphaNumeric = isAlphaNumeric;
exports.isNumberOrStringOnly = isAlphaNumeric;
function isNumeric(value) {
    return exotic_1.isNumber(value);
}
exports.isNumeric = isNumeric;
function isAlphabet(value) {
    return value && exotic_1.isString(value) && onlyAlphabets.test(value);
}
exports.isAlphabet = isAlphabet;
function isValidCity(value) {
    return value && matchCity.test(value);
}
exports.isValidCity = isValidCity;
exports.default = isAlphaNumeric;
//# sourceMappingURL=isAlphaNumeric.js.map