Skip to content

Commit

Permalink
bump(Version):
Browse files Browse the repository at this point in the history
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
rluiten committed Dec 30, 2015
1 parent 41943c9 commit ba28ee0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion elm-package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "4.0.0",
"version": "4.1.0",
"summary": "Mailcheck suggest corrections to errors in email addresses",
"repository": "https://github.com/rluiten/mailcheck.git",
"license": "BSD3",
Expand Down
12 changes: 7 additions & 5 deletions src/Mailcheck.elm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -52,6 +53,7 @@ import StringDistance exposing (sift3Distance)
import MaybeUtils exposing (thenAnd, thenOneOf)


{-| Record type alias for mailparts. -}
type alias MailParts =
{
topLevelDomain : String,
Expand Down Expand Up @@ -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
Expand All @@ -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 =
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/MailcheckTest.elm
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ runFcdTest name data =
test input -- input String doubles as test name
(assertEqual
expect
(findClosestDomain 2.0 input domains)
(findClosestDomain input domains)
)
)
data
Expand Down

0 comments on commit ba28ee0

Please sign in to comment.