Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/a/to-ms
Tiny chained ms creation util for NodeJS and browsers
https://github.com/a/to-ms
Last synced: 6 days ago
JSON representation
Tiny chained ms creation util for NodeJS and browsers
- Host: GitHub
- URL: https://github.com/a/to-ms
- Owner: A
- Created: 2014-09-27T12:11:48.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2019-07-25T12:45:49.000Z (over 5 years ago)
- Last Synced: 2024-10-09T05:17:48.401Z (about 1 month ago)
- Language: JavaScript
- Homepage: http://shuvalov-anton.github.io/to-ms
- Size: 54.7 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# toMs
[![Build Status](https://travis-ci.org/shuvalov-anton/to-ms.svg)](https://travis-ci.org/shuvalov-anton/to-ms)
[![Code Climate](https://codeclimate.com/github/shuvalov-anton/to-ms/badges/gpa.svg)](https://codeclimate.com/github/shuvalov-anton/to-ms)
[![Coverage Status](https://coveralls.io/repos/shuvalov-anton/to-ms/badge.png?branch=master)](https://coveralls.io/r/shuvalov-anton/to-ms?branch=master)[![NPM](https://nodei.co/npm/to-ms.png?downloads=true)](https://nodei.co/npm/to-ms/)
Simple and human friendly millisecond implementation with awesome chaining. Thanks [@subzey][1] for a sketch and advise :D
[1]: https://github.com/subzey
## Install
```
npm install to-ms
```## Examples
```js
var toMs = require('to-ms');setTimeout(
function () {
/* do something */
}, toMs
.hour()
.minutes(15)
.seconds(30)
);
```## Chaining
All methods are chainable. I mean, you can pretty simple write something like this:
```js
var ms = toMs
.days(30)
.hours(10)
.minutes(30)
.seconds(45);
```## Browser Support
Just use `window.toMs`. To support legacy browsers you must use [ES5-Shim][2].
[2]: https://github.com/es-shims/es5-shim
## Methods
- `toMs.second()`
- `toMs.seconds(Number)`
- `toMs.minute()`
- `toMs.minutes(Number)`
- `toMs.hour()`
- `toMs.hours(Number)`
- `toMs.day()`
- `toMs.days(Number)`
- `toMs.week()`
- `toMs.weeks(Number)`
- `toMs.year()`
- `toMs.years(Number)`