/** * Sanitizes the specified email address by removing any character that is not allowed, and converting it to lowercase. * * @param {string} email - email address */ const sanitizeEmail = ( email: string ): string => email.replace( /[^0-9a-z_'.-]/gi, '' ).toLowerCase()
function lowerCaseKeys(obj: Record<string, any>): Record<string, any> { return Object.keys(obj).reduce((memo, key) => { memo[key.toLowerCase()] = obj[key]; return memo; }, {}); }
// ensure email is in lowercase User.beforeValidate((user, options) => { user.email = String(user.email).toLowerCase(); if (!user.selector) { user.name = user.firstname; addSelector(user); delete user.name; } });
keyword.split(/\s+/g).slice(0, 3).forEach(function(key) { if (/^(c|s):(\S*)$/i.test(key)) { k[RegExp.$1.toLowerCase()] = RegExp.$2; } else { k['k' + i++] = key; } });
toAnchorRef(reflection: Reflection) { function parseAnchorRef(ref: string) { return ref.replace(/"/g, '').replace(/ /g, '-'); } let anchorPrefix = ''; reflection.flags.forEach(flag => (anchorPrefix += `${flag}-`)); const prefixRef = parseAnchorRef(anchorPrefix); const reflectionRef = parseAnchorRef(reflection.name); const anchorRef = prefixRef + reflectionRef; return 'markdown-header-' + anchorRef.toLowerCase(); }
constructor(path, { caseTo = 'lower' }) { super(...arguments); this.normaliseValue = a => a; if (caseTo && caseTo.toString().toLowerCase() === 'upper') { this.normaliseValue = a => a && a.toString().toUpperCase(); } else if (caseTo && caseTo.toString().toLowerCase() === 'lower') { this.normaliseValue = a => a && a.toString().toLowerCase(); } this.isOrderable = true; }
// from https://stackoverflow.com/questions/46155/how-can-you-validate-an-email-address-in-javascript const validEmailAddress = (email) => { // eslint-disable-next-line no-useless-escape, max-len const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ return re.test(String(email).toLowerCase()) }
// These are HTML attributes that must be numbers. ['rowSpan', 'start'].forEach(function (name) { properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty name.toLowerCase(), // attributeName null, // attributeNamespace false); });
/** * Given a locale, get the 2 character one. * @param {String} locale Locale of the language. * @returns {String} Locale in 2 character length. */ static getTruncatedLocale(locale) { return locale ? locale.substr(0, 2).toLowerCase() : undefined; }
function getByName(name) { /* istanbul ignore next */ if (!name) return null; let n = Object.keys(Cachers).find(n => n.toLowerCase() == name.toLowerCase()); if (n) return Cachers[n]; }
// ensure email is in lowercase User.beforeValidate((user, options) => { user.email = String(user.email).toLowerCase(); if (!user.selector) { user.name = user.firstname; addSelector(user); delete user.name; } });
// from https://stackoverflow.com/questions/46155/how-can-you-validate-an-email-address-in-javascript const validEmailAddress = (email) => { // eslint-disable-next-line no-useless-escape, max-len const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ return re.test(String(email).toLowerCase()) }
function getByName(name) { /* istanbul ignore next */ if (!name) return null; let n = Object.keys(Validators).find(n => n.toLowerCase() == name.toLowerCase()); if (n) return Validators[n]; }
// These attribute exists both in HTML and SVG. // The attribute name is case-sensitive in SVG so we can't just use // the React name like we do for attributes that exist only in HTML. ['tabIndex', 'crossOrigin'].forEach(function (attributeName) { properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty attributeName.toLowerCase(), // attributeName null, // attributeNamespace false); });
['src', 'href', 'action', 'formAction'].forEach(function (attributeName) { properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty attributeName.toLowerCase(), // attributeName null, // attributeNamespace true); });