-
-
Notifications
You must be signed in to change notification settings - Fork 11
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 (#3)
- Loading branch information
1 parent
3364582
commit 6a8de4f
Showing
4 changed files
with
35 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 |
---|---|---|
@@ -1,6 +1,29 @@ | ||
/** | ||
* Convert a camelized/dasherized/underscored string into a humanized one: `fooBar-Baz_Faz` → `Foo bar baz faz`. | ||
* | ||
* @param text - The string to make human readable. | ||
*/ | ||
export default function humanizeString(text: string): string; | ||
declare const humanizeString: { | ||
/** | ||
Convert a camelized/dasherized/underscored string into a humanized one: `fooBar-Baz_Faz` → `Foo bar baz faz`. | ||
@param text - The string to make human readable. | ||
@example | ||
``` | ||
import humanizeString = require('humanize-string'); | ||
humanizeString('fooBar'); | ||
//=> 'Foo bar' | ||
humanizeString('foo-bar'); | ||
//=> 'Foo bar' | ||
humanizeString('foo_bar'); | ||
//=> 'Foo bar' | ||
``` | ||
*/ | ||
(text: string): string; | ||
|
||
// TODO: Remove this for the next major release, refactor the whole definition to: | ||
// declare function humanizeString(text: string): string; | ||
// export = humanizeString; | ||
default: typeof humanizeString; | ||
}; | ||
|
||
export = humanizeString; |
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,4 +1,4 @@ | ||
import {expectType} from 'tsd-check'; | ||
import humanizeString from '.'; | ||
import {expectType} from 'tsd'; | ||
import humanizeString = require('.'); | ||
|
||
expectType<string>(humanizeString('fooBar')); |
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