-
-
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.
Refactor TypeScript definition to CommonJS compatible export (#5)
- Loading branch information
1 parent
a6ded92
commit 2256dca
Showing
4 changed files
with
38 additions
and
15 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 |
---|---|---|
@@ -1,11 +1,33 @@ | ||
import {Options} from 'filenamify'; | ||
import {Options as FilenamifyOptions} from 'filenamify'; | ||
|
||
/** | ||
* Convert a URL to a valid filename. | ||
* | ||
* @param input - A URL to convert to a valid filename. | ||
* @returns A valid filename for `input`. | ||
*/ | ||
export default function filenamifyUrl(input: string, options?: Options): string; | ||
declare namespace filenamifyUrl { | ||
type Options = FilenamifyOptions; | ||
} | ||
|
||
export {Options} from 'filenamify'; | ||
declare const filenamifyUrl: { | ||
/** | ||
Convert a URL to a valid filename. | ||
@param input - A URL to convert to a valid filename. | ||
@returns A valid filename for `input`. | ||
@example | ||
``` | ||
import filenamifyUrl = require('filenamify-url'); | ||
filenamifyUrl('http://sindresorhus.com/foo?bar=baz'); | ||
//=> 'sindresorhus.com!foo!bar=baz' | ||
filenamifyUrl('http://sindresorhus.com/foo', {replacement: '🐴'}); | ||
//=> 'sindresorhus.com🐴foo' | ||
``` | ||
*/ | ||
(input: string, options?: filenamifyUrl.Options): string; | ||
|
||
// TODO: Remove this for the next major release, refactor the whole definition to: | ||
// declare function filenamifyUrl(input: string, options?: Options): string; | ||
// export = filenamifyUrl; | ||
default: typeof filenamifyUrl; | ||
}; | ||
|
||
export = filenamifyUrl; |
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
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