UNPKG

one-schema

Version:
16 lines (15 loc) 555 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = (function (input) { if (typeof input !== 'string') { return false; } var atInd = input.lastIndexOf('@'); var dotInd = input.lastIndexOf('.'); var len = input.length; return len > 4 && // "a@a.a" is smallest size atInd === input.indexOf('@') && // no multiple @ symbols in email atInd > 0 && // no "@.com" (dotInd - atInd) > 1 && // no "a@.com" dotInd !== (len - 1); // no dot at end of email });