Skip to content

Commit

Permalink
fix: Fix thrown error with input that only contains whitespaces
Browse files Browse the repository at this point in the history
Fix issues #32, #61
  • Loading branch information
jpstevens authored and jhnns committed May 27, 2019
1 parent 601d192 commit 1d1a24a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/parseDomain.js
Expand Up @@ -56,7 +56,7 @@ function parseDomain(url, options) {
let urlSplit;
let domain;

if (normalizedUrl === null) {
if (!normalizedUrl) {
return null;
}

Expand Down
2 changes: 2 additions & 0 deletions test/parseDomain.test.js
Expand Up @@ -142,6 +142,8 @@ describe("parseDomain(url)", () => {
expect(parseDomain(undefined)).to.equal(null);
expect(parseDomain({})).to.equal(null);
expect(parseDomain("")).to.equal(null);
expect(parseDomain(" ")).to.equal(null);
expect(parseDomain("\xa0")).to.equal(null);
});

it("should work with domains that could match multiple tlds", () => {
Expand Down

0 comments on commit 1d1a24a

Please sign in to comment.