Skip to content

Wrap an async function to run for at least n milliseconds

License

Notifications You must be signed in to change notification settings

bendrucker/min-run

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

min-run Build Status

Wrap an async function to run for at least n milliseconds

Install

$ npm install --save min-run

Usage

var min = require('min-run')

var getUser = min(fetch, 100)

getUser(1, function (err, user) {
  //=> at least 100ms will elapse before calling  
})

function fetch (id, callback) {
  // ...
}

API

min(fn, [time]) -> function

fn

Required
Type: function

A Node-style async function to wrap.

time

Type: number
Default: 0

The minimum run time for the fn.

License

MIT © Ben Drucker

About

Wrap an async function to run for at least n milliseconds

Resources

License

Stars

Watchers

Forks

Packages

No packages published