From f95bf4140abc37d2b9778588cce51db3dc7bc727 Mon Sep 17 00:00:00 2001 From: Leo Lamprecht Date: Sun, 4 Sep 2016 01:44:19 +0200 Subject: [PATCH] Proper structure for readme --- README.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ee77d0e..dd147d1 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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