# @dnode/duration

> [![dependencies | 2 | 2](https://img.shields.io/badge/dependencies-2%20|%202-blue.svg)](DEPENDENCIES.md)

Latest version **3.1.2** (published 2018-04-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install @dnode/duration
pnpm add @dnode/duration
yarn add @dnode/duration
bun add @dnode/duration
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.1.2 |
| Published | 2018-04-10 |
| First published | 2018-01-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | ^7.6.0 |
| Dependencies | 2 |
| Unpacked size | 2.6 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | sharaal |

## Links

- npm: https://www.npmjs.com/package/@dnode/duration
- Repository: https://github.com/sharaal/dnode
- Homepage: https://github.com/sharaal/dnode#readme
- Issues: https://github.com/sharaal/dnode/issues
- npm.io page: https://npm.io/package/@dnode/duration

## Dependencies (2)

- [moment](https://npm.io/package/moment.md) ^2.20.1
- [parse-duration](https://npm.io/package/parse-duration.md) ^0.1.1

## Recent versions

- 3.1.2 (latest) — 2018-04-10
- 3.1.1 — 2018-02-27
- 3.1.0 — 2018-02-21
- 3.0.0 — 2018-02-13
- 2.0.0 — 2018-02-12
- 1.1.0 — 2018-02-12
- 1.0.1 — 2018-02-06
- 1.0.0 — 2018-01-19

## README

[![dependencies | 2 | 2](https://img.shields.io/badge/dependencies-2%20|%202-blue.svg)](DEPENDENCIES.md)

# Usage

```javascript
const duration = require('@dnode/duration');

const milliseconds = duration('1h 20m').asMilliseconds();
const seconds = duration('1h 20m').asSeconds();
```

## Input formats

Supported by [parse-duration](https://www.npmjs.com/package/parse-duration).

## Output format methods

Supported by [moment.duration](http://momentjs.com/docs/#/durations/).

# FAQ

## Why use it over `moment`?

`moment` split the number and the format in two parameters, e.g. `moment.duration(3, 'days')`. That is not really usable together with environment variables, e.g. `duration(process.env.DURATION || '3 days')`.

---
_Source: https://npm.io/package/@dnode/duration · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
