https://github.com/mdovhopo/better-wait
wait - promise based function that provides human readable interface for delaying some actions for some period of time
https://github.com/mdovhopo/better-wait
hacktoberfest ts wait
Last synced: 12 months ago
JSON representation
wait - promise based function that provides human readable interface for delaying some actions for some period of time
- Host: GitHub
- URL: https://github.com/mdovhopo/better-wait
- Owner: mdovhopo
- License: mit
- Created: 2021-06-13T19:58:42.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-10-02T09:06:09.000Z (over 4 years ago)
- Last Synced: 2024-04-26T20:49:12.899Z (about 2 years ago)
- Topics: hacktoberfest, ts, wait
- Language: TypeScript
- Homepage:
- Size: 353 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# better-wait
[](https://github.com/mdovhopo/better-wait/actions)
[](https://coveralls.io/github/mdovhopo/better-wait?branch=master)
Convenient delay function with human friendly interface
Installation:
```sh
npm i better-wait
yarn add better-wait
```
## Usage
```ts
import { wait } from 'better-wait';
await wait('3s'); // use human readable values for delay
await wait(1000); // use milliseconds if you feel more like a machine
await wait('1 hour', { reject: true }); // promise will reject
await wait('1 year', { returnValue: 'your custom return value' }); // you can also return anything you want
```
Bootstrapped with: [create-ts-lib-gh](https://github.com/glebbash/create-ts-lib-gh)
This project is [Mit Licensed](LICENSE).