Skip to content

Commit

Permalink
Proper structure for readme
Browse files Browse the repository at this point in the history
  • Loading branch information
leo committed Sep 3, 2016
1 parent 171f287 commit f95bf41
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# ms

Use this package to easily convert various time formats to milliseconds. Here are a few examples:
Use this package to easily convert various time formats to milliseconds.

## Examples

```js
ms('2 days') // 172800000
Expand All @@ -13,24 +15,28 @@ ms('5s') // 5000
ms('100') // 100
```

### Convert from milliseconds

```js
ms(60000) // "1m"
ms(2 * 60000) // "2m"
ms(ms('10 hours')) // "10h"
```

### Time format written-out

```js
ms(60000, { long: true }) // "1 minute"
ms(2 * 60000, { long: true }) // "2 minutes"
ms(ms('10 hours'), { long: true }) // "10 hours"
```

- Node/Browser compatible. Published as [`ms`](https://www.npmjs.org/package/ms) in [npm](http://nodejs.org/download).
## Features

- Works both in node and in the browser.
- If a number is supplied to `ms`, a string with a unit is returned.
- If a string that contains the number is supplied, it returns it as
a number (e.g: it returns `100` for `'100'`).
- If you pass a string with a number and a valid unit, the number of
equivalent ms is returned.
- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`).
- If you pass a string with a number and a valid unit, the number of equivalent ms is returned.

## Contribute

Expand Down

0 comments on commit f95bf41

Please sign in to comment.