-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moving to typescript
- Loading branch information
Showing
4 changed files
with
43 additions
and
8 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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
Get to know how long it will take to read a paragraph, text or easy acording | ||
to a [Medium's article](https://help.medium.com/hc/en-us/articles/214991667-Read-time). | ||
Read time is based on the average reading speed of an adult (roughly 265 WPM). | ||
@param input - The input to analize how long it will take to read. | ||
@param textOrWpm - Alternative text you want to introduce, otherwise the reading speed (wpm). | ||
@param wpm - Reading speed, word per minutes (wpm). | ||
Default: `265`. | ||
@example | ||
``` | ||
import m2r from 'minutes-to-read'; | ||
m2r('Lorem ipsum'); | ||
// => less than a min to read | ||
``` | ||
*/ | ||
declare function m2r( | ||
input: string, | ||
textOrWpm?: number | string, | ||
wpm?: number, | ||
): string; | ||
|
||
export = m2r; |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import {expectType} from 'tsd'; | ||
import m2r = require('.'); | ||
|
||
expectType<string>(m2r('Lorem ipsum')); | ||
expectType<string>(m2r('Lorem ipsum', 1)); | ||
expectType<string>(m2r('Lorem ipsum', 'minutes to read')); | ||
expectType<string>(m2r('Lorem ipsum', 'minutes to read', 1)); |
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