@visulima/disposable-email-domains 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{createRequire as m}from"node:module";let p;const _=e=>(p??=m(import.meta.url))(e),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=e=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[t,s]=r.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return r.getBuiltinModule(e)}return _(e)},{readFileSync:h}=u("node:fs"),{dirname:y,join:w}=u("node:path"),{fileURLToPath:j}=u("node:url"),b=/\.$/;let n,d=!1,c=!1;const g=j(import.meta.url),v=y(g),D=()=>{try{const e=w(v,"..","dist","domains.json"),t=h(e,"utf8"),s=JSON.parse(t);if(!Array.isArray(s))throw new TypeError("dist/domains.json did not contain a JSON array.");return s}catch(e){c||(c=!0,console.warn("[@visulima/disposable-email-domains] Failed to load dist/domains.json; disposable email detection is disabled.",e));return}},f=()=>{if(n===void 0){const e=D();if(e===void 0)return new Set;n=new Set(e),d=!0}return n},E=e=>{n=new Set(e),d=!0,c=!1},O=async()=>{await Promise.resolve(),f()},P=()=>d,S=e=>{if(!e||typeof e!="string")return;const t=e.toLowerCase().trim(),s=t.lastIndexOf("@");return s===-1||s===0||s===t.length-1?void 0:t.slice(s+1).replace(b,"")||void 0},L=e=>e instanceof Set?{customDomains:e}:e??{},l=(e,t,s)=>{if(s.has(e))return!0;for(let o=1;o<t.length;o+=1)if(s.has(t.slice(o).join(".")))return!0;return!1},T=(e,t)=>{if(!e||typeof e!="string")return!1;const{allowDomains:s,customDomains:o}=L(t),i=e.toLowerCase().trim(),a=i.split(".");return s&&s.size>0&&l(i,a,s)?!1:o&&o.size>0&&l(i,a,o)?!0:l(i,a,f())},q=(e,t)=>{const s=S(e);return s?T(s,t):!1},R=(e,t)=>{const s=new Map;for(const o of e)s.set(o,q(o,t));return s};export{R as areDisposableEmails,S as extractDomain,T as isDisposableDomain,q as isDisposableEmail,P as isListLoaded,O as preload,E as setDomains};
1
+ import{createRequire as f}from"node:module";let p;const h=e=>(p??=f(import.meta.url))(e),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,d=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[s,t]=o.versions.node.split(".").map(Number);if(s>22||s===22&&t>=3||s===20&&t>=16)return o.getBuiltinModule(e)}return h(e)},{readFileSync:_}=d("node:fs"),{dirname:D,join:y}=d("node:path"),{fileURLToPath:g}=d("node:url"),j=/\.$/;let i,u=!1,l=!1;const v=g(import.meta.url),w=D(v),b=()=>{try{const e=y(w,"..","dist","domains.json"),s=_(e,"utf8"),t=JSON.parse(s);if(!Array.isArray(t))throw new TypeError("dist/domains.json did not contain a JSON array.");return t}catch(e){l||(l=!0,console.warn("[@visulima/disposable-email-domains] Failed to load dist/domains.json; disposable email detection is disabled.",e));return}},m=()=>{if(i===void 0){const e=b();if(e===void 0)return new Set;i=new Set(e),u=!0}return i},P=e=>{i=new Set(e),u=!0,l=!1},R=async()=>{await Promise.resolve(),m()},x=()=>u,S=e=>{if(!e||typeof e!="string")return;const s=e.toLowerCase().trim(),t=s.lastIndexOf("@");return t===-1||t===0||t===s.length-1?void 0:s.slice(t+1).replace(j,"")||void 0},L=e=>e instanceof Set?{customDomains:e}:e??{},c=(e,s,t)=>{if(t.has(e))return!0;for(let n=1;n<s.length;n+=1)if(t.has(s.slice(n).join(".")))return!0;return!1},T=(e,s)=>{if(!e||typeof e!="string")return!1;const{allowDomains:t,customDomains:n}=L(s),r=e.toLowerCase().trim(),a=r.split(".");return t&&t.size>0&&c(r,a,t)?!1:n&&n.size>0&&c(r,a,n)?!0:c(r,a,m())},E=(e,s)=>{const t=S(e);return t?T(t,s):!1},z=(e,s)=>{const t=new Map;for(const n of e)t.set(n,E(n,s));return t};export{z as areDisposableEmails,S as extractDomain,T as isDisposableDomain,E as isDisposableEmail,x as isListLoaded,R as preload,P as setDomains};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/disposable-email-domains",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "A regularly updated list of disposable and temporary email domains.",
5
5
  "keywords": [
6
6
  "disposable-email",