forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmailcheck-tests.ts
58 lines (52 loc) · 1.85 KB
/
mailcheck-tests.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/// <reference path="../jquery/jquery.d.ts"/>
/// <reference path="mailcheck.d.ts"/>
import MC = require('mailcheck');
var domains = ['gmail.com', 'aol.com'];
var secondLevelDomains = ['hotmail']
var topLevelDomains = ["com", "net", "org"];
var superStringDistance = function(string1: string, string2: string): number {
// a string distance algorithm of your choosing
return 0;
};
$('#email').on('blur', function() {
$(this).mailcheck({
email: 'nonoptional@example.com',
domains: domains, // optional
secondLevelDomains: secondLevelDomains, // optional
topLevelDomains: topLevelDomains, // optional
distanceFunction: superStringDistance, // optional
suggested: function(element: JQuery, suggestion: MailcheckModule.ISuggestion) {
// callback code
},
empty: function(element: JQuery) {
// callback code
}
});
});
Mailcheck.run({
email: 'nonoptional@example.com',
domains: domains, // optional
secondLevelDomains: secondLevelDomains, // optional
topLevelDomains: topLevelDomains, // optional
distanceFunction: superStringDistance, // optional
suggested: function(suggestion: MailcheckModule.ISuggestion) {
// callback code
},
empty: function() {
// callback code
}
});
MC.run({
email: 'nonoptional@example.com',
domains: domains, // optional
secondLevelDomains: secondLevelDomains, // optional
topLevelDomains: topLevelDomains, // optional
distanceFunction: superStringDistance, // optional
suggested: function(suggested: MailcheckModule.ISuggestion) {
// callback code
suggested.address === '' && suggested.full === '' && suggested.domain === '';
},
empty: function() {
// callback code
}
});