UNPKG

i18n-node-server

Version:

NodeJS http server to store your internationalized phrases

18 lines (14 loc) 337 B
const identRegex = /[a-zA-Z0-9\.\_\-\,]+/gi; export function validateIdent(ident: string): boolean { if (typeof ident !== "string") { return false; } if (!ident) { return false; } const matched = ident.match(identRegex); if (!matched || !matched.length) { return false; } return matched[0] === ident; }