min-run

1.0.0 • Public • Published

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

Package Sidebar

Install

npm i min-run

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • bendrucker