aboutsummaryrefslogtreecommitdiff
path: root/node_modules/isemail/lib/index.d.ts
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/isemail/lib/index.d.ts')
-rw-r--r--node_modules/isemail/lib/index.d.ts64
1 files changed, 64 insertions, 0 deletions
diff --git a/node_modules/isemail/lib/index.d.ts b/node_modules/isemail/lib/index.d.ts
new file mode 100644
index 00000000..2ece3854
--- /dev/null
+++ b/node_modules/isemail/lib/index.d.ts
@@ -0,0 +1,64 @@
+// Code shows a string is valid,
+// but docs require string array or object.
+type TLDList = string | string[] | { [topLevelDomain: string]: any };
+
+type BaseOptions = {
+ tldWhitelist?: TLDList;
+ tldBlacklist?: TLDList;
+ minDomainAtoms?: number;
+ allowUnicode?: boolean;
+};
+
+type OptionsWithBool = BaseOptions & {
+ errorLevel?: false;
+};
+
+type OptionsWithNumThreshold = BaseOptions & {
+ errorLevel?: true | number;
+};
+
+interface Validator {
+ /**
+ * Check that an email address conforms to RFCs 5321, 5322, 6530 and others.
+ *
+ * ```
+ * import * as IsEmail from "isemail";
+ *
+ * IsEmail.validate("test@e.com");
+ * // => true
+ * ```
+ */
+ validate(email: string): boolean;
+
+ /**
+ * Check that an email address conforms to RFCs 5321, 5322, 6530 and others.
+ *
+ * ```
+ * import * as IsEmail from "isemail";
+ *
+ * IsEmail.validate("test@iana.org", { errorLevel: false });
+ * // => true
+ * ```
+ */
+ validate(email: string, options: OptionsWithBool): boolean;
+
+ /**
+ * Check that an email address conforms to RFCs 5321, 5322, 6530 and others.
+ *
+ * ```
+ * import * as IsEmail from "isemail";
+ *
+ * IsEmail.validate("test@iana.org", { errorLevel: true });
+ * // => 0
+ * IsEmail.validate("test @e.com", { errorLevel: 50 });
+ * // => 0
+ * IsEmail.validate('test @e.com', { errorLevel: true })
+ * // => 49
+ * ```
+ */
+ validate(email: string, options: OptionsWithNumThreshold): number;
+}
+
+declare const IsEmail: Validator;
+
+export = IsEmail;