1.0.0 • Published 8 years ago

min-run v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

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