mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
finish test
This commit is contained in:
parent
666a4621ac
commit
c1252aef02
@ -7,8 +7,9 @@ var domains = ['gmail.com', 'aol.com'];
|
||||
var secondLevelDomains = ['hotmail']
|
||||
var topLevelDomains = ["com", "net", "org"];
|
||||
|
||||
var superStringDistance = function(string1: string, string2: string): void {
|
||||
var superStringDistance = function(string1: string, string2: string): number {
|
||||
// a string distance algorithm of your choosing
|
||||
return 0;
|
||||
};
|
||||
|
||||
$('#email').on('blur', function() {
|
||||
@ -17,10 +18,10 @@ $('#email').on('blur', function() {
|
||||
secondLevelDomains: secondLevelDomains, // optional
|
||||
topLevelDomains: topLevelDomains, // optional
|
||||
distanceFunction: superStringDistance, // optional
|
||||
suggested: function(element, suggestion) {
|
||||
suggested: function(element: JQuery, suggestion: MailcheckModule.ISuggestion) {
|
||||
// callback code
|
||||
},
|
||||
empty: function(element) {
|
||||
empty: function(element: JQuery) {
|
||||
// callback code
|
||||
}
|
||||
});
|
||||
@ -31,7 +32,7 @@ Mailcheck.run({
|
||||
secondLevelDomains: secondLevelDomains, // optional
|
||||
topLevelDomains: topLevelDomains, // optional
|
||||
distanceFunction: superStringDistance, // optional
|
||||
suggested: function(suggestion) {
|
||||
suggested: function(suggestion: MailcheckModule.ISuggestion) {
|
||||
// callback code
|
||||
},
|
||||
empty: function() {
|
||||
@ -44,7 +45,7 @@ MC.run({
|
||||
secondLevelDomains: secondLevelDomains, // optional
|
||||
topLevelDomains: topLevelDomains, // optional
|
||||
distanceFunction: superStringDistance, // optional
|
||||
suggested: function(suggested) {
|
||||
suggested: function(suggested: MailcheckModule.ISuggestion) {
|
||||
// callback code
|
||||
suggested.address === '' && suggested.full === '' && suggested.domain === '';
|
||||
},
|
||||
|
||||
19
mailcheck/mailcheck.d.ts
vendored
19
mailcheck/mailcheck.d.ts
vendored
@ -21,6 +21,14 @@ declare module MailcheckModule {
|
||||
(element: JQuery, suggested: ISuggestion): void;
|
||||
}
|
||||
|
||||
export interface IJQueryEmpty {
|
||||
(element: JQuery): void;
|
||||
}
|
||||
|
||||
export interface IEmpty {
|
||||
(): void;
|
||||
}
|
||||
|
||||
export interface ISuggested {
|
||||
(suggested: ISuggestion): void;
|
||||
}
|
||||
@ -41,13 +49,8 @@ declare module MailcheckModule {
|
||||
domains?: string[];
|
||||
topLevelDomains?: string[];
|
||||
distanceFunction?: IDistanceFunction;
|
||||
suggested?: ISuggested;
|
||||
empty?: () => void;
|
||||
}
|
||||
|
||||
export interface IJQueryOptions extends IOptions {
|
||||
suggested?: IJQuerySuggested;
|
||||
empty?: (element: JQuery) => void;
|
||||
suggested?: ISuggested | IJQuerySuggested;
|
||||
empty?: IEmpty | IJQueryEmpty;
|
||||
}
|
||||
|
||||
export interface Static {
|
||||
@ -67,7 +70,7 @@ declare module MailcheckModule {
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
mailcheck(opts: MailcheckModule.IJQueryOptions): void;
|
||||
mailcheck(opts: MailcheckModule.IOptions): void;
|
||||
}
|
||||
|
||||
declare module 'mailcheck' {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user