mirror of
https://github.com/cupcakearmy/uhrwerk.git
synced 2024-12-22 07:26:24 +00:00
readme
This commit is contained in:
parent
8679a04346
commit
99d35a9ade
19
README.md
19
README.md
@ -1,22 +1,19 @@
|
|||||||
# uhrwerk 🕰
|
# uhrwerk 🕰
|
||||||
|
|
||||||
![dependencies](https://badgen.net/david/dep/cupcakearmy/uhrwerk)
|
![package size](https://img.shields.io/bundlephobia/min/uhrwerk?style=flat)
|
||||||
![downloads badge](https://badgen.net/npm/dt/uhrwerk)
|
![downloads badge](https://img.shields.io/npm/dt/uhrwerk)
|
||||||
![types badge](https://badgen.net/npm/types/uhrwerk)
|
![types badge](https://img.shields.io/npm/types/uhrwerk)
|
||||||
![version badge](https://badgen.net/npm/v/uhrwerk)
|
![version badge](https://img.shields.io/npm/v/uhrwerk)
|
||||||
![minzip size badge](https://badgen.net/bundlephobia/minzip/uhrwerk)
|
|
||||||
|
|
||||||
Minimal time duration utility. Replacement for MomentJS Durations. If you are looking into the time component of MomentJS check out this awesome library [dayjs](https://github.com/iamkun/dayjs).
|
Minimal time duration utility. Replacement for MomentJS Durations. If you are looking into the time component of MomentJS check out this awesome library [dayjs](https://github.com/iamkun/dayjs).
|
||||||
|
|
||||||
📦 It's **tiny**: [1.6kB](https://bundlephobia.com/result?p=uhrwerk@1.0.0) vs moment js [231.7kb](https://bundlephobia.com/result?p=moment@latest)
|
📦 It's **tiny**: [2kB](https://bundlephobia.com/package/uhrwerk@latest) vs moment js [295kB](https://bundlephobia.com/result?p=moment@latest)
|
||||||
|
|
||||||
**Typescript typings included**
|
🌈 No dependencies, types included.
|
||||||
|
|
||||||
## Quickstart 🚀
|
## Quickstart 🚀
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
// Whatever import you prefer
|
|
||||||
// const { Duration } = require('uhrwerk')
|
|
||||||
import { Duration } from 'uhrwerk'
|
import { Duration } from 'uhrwerk'
|
||||||
|
|
||||||
const d = new Duration(10, 'days')
|
const d = new Duration(10, 'days')
|
||||||
@ -144,8 +141,8 @@ The order of the array is important. The first match will return, like in a stan
|
|||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const humanizer = [
|
const humanizer = [
|
||||||
[d => d.days() > 1, d => `${d.days()} days`],
|
[(d) => d.days() > 1, (d) => `${d.days()} days`],
|
||||||
[d => d.days() > 0, d => `1 day`],
|
[(d) => d.days() > 0, (d) => `1 day`],
|
||||||
[() => true, () => 'catch all, below 1 day'],
|
[() => true, () => 'catch all, below 1 day'],
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user