-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(findClosestDomain ): Undid change to add threshold, as did not want to change the API to keep change update to MINOR one.
- Loading branch information
Showing
4 changed files
with
15 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,10 +13,12 @@ When your user types in "[email protected]", it will suggest "[email protected]". | |
|
||
It is currently worth looking at the documentation at https://github.com/mailcheck/mailcheck | ||
|
||
2015/12/30 | ||
Thanks to https://github.com/Adrian2112 for a pull request, he created the mailparts | ||
records based email splitter. I have retained splitemail call to make the version change | ||
a Minor, but it now just uses the mailparts logic. | ||
4.1.0 2015/12/30 | ||
|
||
Thanks to https://github.com/Adrian2112 for a pull request, he created the | ||
`mailParts` functiion. I have retained `splitEmail` in API to make the version | ||
hange a Minor, but it now just uses the mailParts logic. Adrian also | ||
contributed a few refactors I have pulled in manually. | ||
|
||
|
||
Installation | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ This is a port of this javascript library https://github.com/mailcheck/mailcheck | |
@docs encodeEmail | ||
@docs splitEmail | ||
@docs mailParts | ||
@docs MailParts | ||
@docs findClosestDomain | ||
# Default domain lists used by suggest | ||
|
@@ -52,6 +53,7 @@ import StringDistance exposing (sift3Distance) | |
import MaybeUtils exposing (thenAnd, thenOneOf) | ||
|
||
|
||
{-| Record type alias for mailparts. -} | ||
type alias MailParts = | ||
{ | ||
topLevelDomain : String, | ||
|
@@ -132,7 +134,7 @@ checkPartsNotInList secondLevelDomains topLevelDomains mailParts = | |
|
||
closestDomain : List String -> MailParts -> Maybe (String, String, String) | ||
closestDomain domains mailParts = | ||
let closestDomain = findClosestDomain domainThreshold mailParts.domain domains | ||
let closestDomain = findClosestDomain mailParts.domain domains | ||
result closestDomain = Just (mailParts.address, closestDomain, mailParts.address ++ "@" ++ closestDomain) | ||
isDifferentDomain closestDomain = | ||
if closestDomain == mailParts.domain then | ||
|
@@ -149,7 +151,7 @@ closestSecondLevelDomain : List String -> List String -> MailParts -> Maybe (Str | |
closestSecondLevelDomain secondLevelDomains topLevelDomains mailParts = | ||
let | ||
findClosest threshold domains = | ||
findClosestDomain threshold domains | ||
findClosestDomain domains | ||
findResultSld = findClosest secondLevelThreshold mailParts.secondLevelDomain secondLevelDomains | ||
findResultTld = findClosest topLevelThreshold mailParts.topLevelDomain topLevelDomains | ||
suggestedDomain = | ||
|
@@ -372,9 +374,9 @@ is equivalent to | |
findClosestDomainWith sift3Distance topLevelThreshold "[email protected]" slds tlds | ||
``` | ||
-} | ||
findClosestDomain : Float -> String -> List String -> Maybe String | ||
findClosestDomain threshold = | ||
findClosestDomainWith sift3Distance threshold | ||
findClosestDomain : String -> List String -> Maybe String | ||
findClosestDomain = | ||
findClosestDomainWith sift3Distance domainThreshold | ||
|
||
|
||
{-| Find closest domain in given list of domains using the | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters