From f81cae0b091ab97b5b27e7e2b56fecdafc5d9c72 Mon Sep 17 00:00:00 2001 From: Sefinek Date: Sun, 24 Dec 2023 23:45:56 +0100 Subject: [PATCH] Rename --- README.md | 11 +++++++++++ dist/email-validator.js.map | 1 - dist/{email-validator.js => validator.js} | 2 +- dist/validator.js.map | 1 + webpack.config.js | 2 +- 5 files changed, 14 insertions(+), 3 deletions(-) delete mode 100644 dist/email-validator.js.map rename dist/{email-validator.js => validator.js} (97%) create mode 100644 dist/validator.js.map diff --git a/README.md b/README.md index 7d1dab5..1c38721 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,17 @@ This lightweight module facilitates precise email address validation, returning npm install email-validator ``` +## 🌍 » Browser +### cdn.sefinek.net +```js + +``` +### jsdelivr.net +``` +https://cdn.jsdelivr.net/gh/sefinek24/email-validator@latest/dist/validator.js +``` + + ## 🤔 » Example ```js const emailValidator = require('email-validator'); diff --git a/dist/email-validator.js.map b/dist/email-validator.js.map deleted file mode 100644 index b4e5cb1..0000000 --- a/dist/email-validator.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"email-validator.js","mappings":"2BAAA,MAAM,QAAEA,GAAY,EAAQ,KACtBC,EAAa,oIAEbC,EAAiB,CACtBC,KAAMC,IACL,IAAKA,GAASA,EAAMC,SAAS,KAAM,OAAO,EAE1C,MAAOC,EAAWC,GAAUH,EAAMI,MAAM,KACxC,SAAKF,IAAcC,GAAUD,EAAUG,OAAS,IAAMF,EAAOE,OAAS,SASxE,SAA0BH,GACzB,GAAIA,EAAUI,WAAW,MAAQJ,EAAUK,SAAS,KAAM,OAAO,EAEjE,IAAIC,EAAW,KACf,IAAK,MAAMC,KAAQP,EAAW,CAC7B,GAAa,MAATO,GAA6B,MAAbD,EAAkB,OAAO,EAC7CA,EAAWC,CACZ,CACA,OAAO,CACR,CAhBOC,CAAiBR,KAkBxB,SAAuBC,GACtB,MAAMQ,EAAcR,EAAOC,MAAM,KACjC,IAAK,MAAMQ,KAAQD,EAClB,GAAoB,IAAhBC,EAAKP,QAAgBO,EAAKP,OAAS,IAAMO,EAAKN,WAAW,MAAQM,EAAKL,SAAS,KAAM,OAAO,EAEjG,OAAO,CACR,CAxBuCM,CAAcV,KAE5CN,EAAWE,KAAKC,EAAM,EAE9BJ,WAsBDkB,EAAOC,QAAUjB,C,m0BCnCbkB,EAA2B,CAAC,GAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaJ,QAGrB,IAAID,EAASE,EAAyBE,GAAY,CAGjDH,QAAS,CAAC,GAOX,OAHAM,EAAoBH,GAAUJ,EAAQA,EAAOC,QAASE,GAG/CH,EAAOC,OACf,CCnB0BE,CAAoB,I","sources":["webpack://email-validator/./src/index.js","webpack://email-validator/webpack/bootstrap","webpack://email-validator/webpack/startup"],"sourcesContent":["const { version } = require('../package.json');\r\nconst MAIN_REGEX = /^[-!#$%&'*+\\\\/0-9=?A-Z^_a-z`{|}~](\\.?[-!#$%&'*+\\\\/0-9=?A-Z^_a-z`{|}~])*@[a-zA-Z0-9](-*\\.?[a-zA-Z0-9])*\\.[a-zA-Z](-?[a-zA-Z0-9])+$/;\r\n\r\nconst emailValidator = {\r\n\ttest: email => {\r\n\t\tif (!email || email.includes('*')) return false;\r\n\r\n\t\tconst [localPart, domain] = email.split('@');\r\n\t\tif (!localPart || !domain || localPart.length > 64 || domain.length > 255) return false;\r\n\r\n\t\tif (!isValidLocalPart(localPart) || !isValidDomain(domain)) return false;\r\n\r\n\t\treturn MAIN_REGEX.test(email);\r\n\t},\r\n\tversion,\r\n};\r\n\r\nfunction isValidLocalPart(localPart) {\r\n\tif (localPart.startsWith('.') || localPart.endsWith('.')) return false;\r\n\r\n\tlet prevChar = null;\r\n\tfor (const char of localPart) {\r\n\t\tif (char === '.' && prevChar === '.') return false;\r\n\t\tprevChar = char;\r\n\t}\r\n\treturn true;\r\n}\r\n\r\nfunction isValidDomain(domain) {\r\n\tconst domainParts = domain.split('.');\r\n\tfor (const part of domainParts) {\r\n\t\tif (part.length === 0 || part.length > 63 || part.startsWith('-') || part.endsWith('-')) return false;\r\n\t}\r\n\treturn true;\r\n}\r\n\r\nmodule.exports = emailValidator;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(138);\n"],"names":["version","MAIN_REGEX","emailValidator","test","email","includes","localPart","domain","split","length","startsWith","endsWith","prevChar","char","isValidLocalPart","domainParts","part","isValidDomain","module","exports","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/email-validator.js b/dist/validator.js similarity index 97% rename from dist/email-validator.js rename to dist/validator.js index 19d88e8..e19bb4a 100644 --- a/dist/email-validator.js +++ b/dist/validator.js @@ -1,2 +1,2 @@ (()=>{var e={138:(e,t,i)=>{const{version:s}=i(147),r=/^[-!#$%&'*+\\/0-9=?A-Z^_a-z`{|}~](\.?[-!#$%&'*+\\/0-9=?A-Z^_a-z`{|}~])*@[a-zA-Z0-9](-*\.?[a-zA-Z0-9])*\.[a-zA-Z](-?[a-zA-Z0-9])+$/,n={test:e=>{if(!e||e.includes("*"))return!1;const[t,i]=e.split("@");return!(!t||!i||t.length>64||i.length>255)&&!(!function(e){if(e.startsWith(".")||e.endsWith("."))return!1;let t=null;for(const i of e){if("."===i&&"."===t)return!1;t=i}return!0}(t)||!function(e){const t=e.split(".");for(const e of t)if(0===e.length||e.length>63||e.startsWith("-")||e.endsWith("-"))return!1;return!0}(i))&&r.test(e)},version:s};e.exports=n},147:e=>{"use strict";e.exports=JSON.parse('{"name":"email-validator","version":"1.0.0","description":"Lightweight npm module for email address validation.","keywords":["email","validation","validator","syntax","email-verify","email-verifier","email-checker","email-address-validator"],"homepage":"https://github.com/sefinek24/email-validator#readme","bugs":{"url":"https://github.com/sefinek24/email-validator/issues"},"repository":{"type":"git","url":"git+https://github.com/sefinek24/email-validator.git"},"license":"MIT","author":"Sefinek (https://sefinek.net)","main":"src/index.js","typings":"index.d.ts","scripts":{"test":"jest","update":"ncu -u && yarn install && yarn up","build":"webpack --config webpack.config.js"},"devDependencies":{"jest":"^29.7.0","webpack":"^5.89.0","webpack-cli":"^5.1.4"}}')}},t={};!function i(s){var r=t[s];if(void 0!==r)return r.exports;var n=t[s]={exports:{}};return e[s](n,n.exports,i),n.exports}(138)})(); -//# sourceMappingURL=email-validator.js.map \ No newline at end of file +//# sourceMappingURL=validator.js.map \ No newline at end of file diff --git a/dist/validator.js.map b/dist/validator.js.map new file mode 100644 index 0000000..902c489 --- /dev/null +++ b/dist/validator.js.map @@ -0,0 +1 @@ +{"version":3,"file":"validator.js","mappings":"2BAAA,MAAM,QAAEA,GAAY,EAAQ,KACtBC,EAAa,oIAEbC,EAAiB,CACtBC,KAAMC,IACL,IAAKA,GAASA,EAAMC,SAAS,KAAM,OAAO,EAE1C,MAAOC,EAAWC,GAAUH,EAAMI,MAAM,KACxC,SAAKF,IAAcC,GAAUD,EAAUG,OAAS,IAAMF,EAAOE,OAAS,SASxE,SAA0BH,GACzB,GAAIA,EAAUI,WAAW,MAAQJ,EAAUK,SAAS,KAAM,OAAO,EAEjE,IAAIC,EAAW,KACf,IAAK,MAAMC,KAAQP,EAAW,CAC7B,GAAa,MAATO,GAA6B,MAAbD,EAAkB,OAAO,EAC7CA,EAAWC,CACZ,CACA,OAAO,CACR,CAhBOC,CAAiBR,KAkBxB,SAAuBC,GACtB,MAAMQ,EAAcR,EAAOC,MAAM,KACjC,IAAK,MAAMQ,KAAQD,EAClB,GAAoB,IAAhBC,EAAKP,QAAgBO,EAAKP,OAAS,IAAMO,EAAKN,WAAW,MAAQM,EAAKL,SAAS,KAAM,OAAO,EAEjG,OAAO,CACR,CAxBuCM,CAAcV,KAE5CN,EAAWE,KAAKC,EAAM,EAE9BJ,WAsBDkB,EAAOC,QAAUjB,C,m0BCnCbkB,EAA2B,CAAC,GAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaJ,QAGrB,IAAID,EAASE,EAAyBE,GAAY,CAGjDH,QAAS,CAAC,GAOX,OAHAM,EAAoBH,GAAUJ,EAAQA,EAAOC,QAASE,GAG/CH,EAAOC,OACf,CCnB0BE,CAAoB,I","sources":["webpack://email-validator/./src/index.js","webpack://email-validator/webpack/bootstrap","webpack://email-validator/webpack/startup"],"sourcesContent":["const { version } = require('../package.json');\r\nconst MAIN_REGEX = /^[-!#$%&'*+\\\\/0-9=?A-Z^_a-z`{|}~](\\.?[-!#$%&'*+\\\\/0-9=?A-Z^_a-z`{|}~])*@[a-zA-Z0-9](-*\\.?[a-zA-Z0-9])*\\.[a-zA-Z](-?[a-zA-Z0-9])+$/;\r\n\r\nconst emailValidator = {\r\n\ttest: email => {\r\n\t\tif (!email || email.includes('*')) return false;\r\n\r\n\t\tconst [localPart, domain] = email.split('@');\r\n\t\tif (!localPart || !domain || localPart.length > 64 || domain.length > 255) return false;\r\n\r\n\t\tif (!isValidLocalPart(localPart) || !isValidDomain(domain)) return false;\r\n\r\n\t\treturn MAIN_REGEX.test(email);\r\n\t},\r\n\tversion,\r\n};\r\n\r\nfunction isValidLocalPart(localPart) {\r\n\tif (localPart.startsWith('.') || localPart.endsWith('.')) return false;\r\n\r\n\tlet prevChar = null;\r\n\tfor (const char of localPart) {\r\n\t\tif (char === '.' && prevChar === '.') return false;\r\n\t\tprevChar = char;\r\n\t}\r\n\treturn true;\r\n}\r\n\r\nfunction isValidDomain(domain) {\r\n\tconst domainParts = domain.split('.');\r\n\tfor (const part of domainParts) {\r\n\t\tif (part.length === 0 || part.length > 63 || part.startsWith('-') || part.endsWith('-')) return false;\r\n\t}\r\n\treturn true;\r\n}\r\n\r\nmodule.exports = emailValidator;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(138);\n"],"names":["version","MAIN_REGEX","emailValidator","test","email","includes","localPart","domain","split","length","startsWith","endsWith","prevChar","char","isValidLocalPart","domainParts","part","isValidDomain","module","exports","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__"],"sourceRoot":""} \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index efb7759..d2127e9 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -4,7 +4,7 @@ module.exports = { entry: './src/index.js', mode: 'production', output: { - filename: 'email-validator.js', + filename: 'validator.js', path: path.resolve(__dirname, 'dist'), }, devtool: 'source-map',