-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
- Loading branch information
1 parent
c69f5c7
commit be1db80
Showing
4 changed files
with
18 additions
and
6 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
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import filenamify from 'filenamify'; | ||
import humanizeUrl from 'humanize-url'; | ||
|
||
export default function filenamifyUrl(string, options) { | ||
if (typeof string !== 'string') { | ||
throw new TypeError('Expected a string'); | ||
export default function filenamifyUrl(url, options) { | ||
if (!(typeof url === 'string' || url instanceof URL)) { | ||
throw new TypeError('Expected a string or URL instance'); | ||
} | ||
|
||
return filenamify(decodeURIComponent(humanizeUrl(string)), options); | ||
return filenamify(decodeURIComponent(humanizeUrl(url.toString())), options); | ||
} |
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