Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function find(str) {
let query = trim(str);
let by;
if (/^\+?\d+$/.test(query)) {
by = "diallingCode";
query = query[0] === "+" ? query : `+${query}`;
query = query.toLowerCase();
} else if (query.length <= 2) {
by = "isoCode";
query = query.toUpperCase()
} else {
by = "country";
query = query.toLowerCase();
}
return countryCodes.filter(x => {
switch(by) {
case "diallingCode":
export default (query: string): QueryType => {
let selector = trim(query);
let quantifier: QuantifierType;
let attributeSelector: AttributeSelectorType;
let propertySelector: PropertySelectorType;
if (hasQuantifier(selector)) {
quantifier = getQuantifier(selector);
if (!quantifier.expression) {
throw new Error('Unexpected result.');
}
selector = trim(selector.slice(0, -1 * quantifier.expression.length));
} else {
quantifier = {
accessor: 0,
max: 1,
validatePassword: function(password) {
password = trim(password);
return password.length > 3 ? password : null;
}
}
export function validateVcode(vcode) {
return trim(vcode).length > 0;
}
} else {
quantifier = {
accessor: 0,
max: 1,
min: 1
};
}
if (hasPropertySelector(selector)) {
propertySelector = getPropertySelector(selector);
selector = trim(selector.slice(0, -1 * propertySelector.expression.length));
} else if (hasAttributeSelector(selector)) {
attributeSelector = getAttributeSelector(selector);
selector = trim(selector.slice(0, -1 * attributeSelector.expression.length));
}
return {
attributeSelector,
propertySelector,
quantifier,
selector
};
};
validateEmail: function(email) {
var result = emailRegExp.exec(trim(email.toLowerCase()));
return result && result[0];
}
}
export function validateEmail(email) {
const regExp = /^(([^<>()[\]\\.,;:\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,}))$/;
const result = regExp.exec(trim(email.toLowerCase()));
return result && result[0];
}
export function normalizeGravatarEmail(str) {
return typeof str === "string"
? trim(str.toLowerCase())
: "";
}