Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better MS #168

Closed
wants to merge 3 commits into from
Closed

Better MS #168

wants to merge 3 commits into from

Conversation

notbeer
Copy link

@notbeer notbeer commented Sep 18, 2021

Its compact and fast

It passed all the tests too

Adds more options/features:

ms(123456789) //1 day
ms(123456789, { compactDuration: true }) //1d
ms(123456789, { fullDuration: true }) //1 day, 10 hours, 17 minutes, 36 seconds, 789 milliseconds
ms(123456789, { compactDuration: true, fullDuration: true }) //1d 10h 17m 36s 789ms
ms(123456789, { fullDuration: true, avoidDuration: ['ms'] }) //1 day, 10 hours, 17 minutes, 36 seconds
ms(123456789, { compactDuration: true, fullDuration: true, avoidDuration: ['ms'] }) //1d 10h 17m 36s

Works vice versa too:

ms('1 day') //86400000
ms('1d') //86400000
ms('1 day, 10 hours, 17 minutes, 36 seconds, 789 milliseconds') //123456789
ms('1d 10h 17m 36s 789ms') //123456789

Its compact and fast

It passed all the tests too

Adds more options/features:
```js
ms(123456789) //1 day
ms(123456789, { compactDuration: true }) //1d
ms(123456789, { fullDuration: true }) //1 day, 10 hours, 17 minutes, 36 seconds, 789 milliseconds
ms(123456789, { compactDuration: true, fullDuration: true }) //1d 10h 17m 36s 789ms
```

Works vice versa too:
```js
ms('1 day') //86400000
ms('1d') //86400000
ms('1 day, 10 hours, 17 minutes, 36 seconds, 789 milliseconds') //123456789
ms('1d 10h 17m 36s 789ms') //123456789
```
@notbeer notbeer closed this Sep 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant