@tiaanduplessis/nap

1.0.0 • Public • Published

nap

Unfancy promise based sleep function



Built with ❤︎ by tiaanduplessis and contributors

Table of Contents

Table of Contents Install Usage Contribute License

Install

$ npm install @tiaanduplessis/nap
# OR
$ yarn add @tiaanduplessis/nap

Usage

import nap from '@tiaanduplessis/nap'

nap().then(() => console.log('Took a 1 sec nap'))
nap(3000).then(() => console.log('Took a 3 sec nap'))
nap(5000).then(() => console.log('Took a 5 sec nap'))

async function doThings () {
  await nap(4000)
  console.log('Took a 4 sec nap')
}

doThings()

// Took a 1 sec nap
// Took a 3 sec nap
// Took a 4 sec nap
// Took a 5 sec nap

Contributing

Contributions are welcome!

  1. Fork it.
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Or open up a issue.

License

Licensed under the MIT License.

Readme

Keywords

Package Sidebar

Install

npm i @tiaanduplessis/nap

Weekly Downloads

4

Version

1.0.0

License

MIT

Last publish

Collaborators

  • tiaanduplessis