promisen.js
function wait(msec) {
    return waitTask;

    function waitTask(value) {
      var that = this;
      return new promisen.Promise(function(resolve) {
        setTimeout(function() {
          resolve.call(that, value);
        }, msec);
      });
    }
  }
function wait(msec) {
    return waitTask;

    function waitTask(value) {
      var that = this;
      return new promisen.Promise(function(resolve) {
        setTimeout(function() {
          resolve.call(that, value);
        }, msec);
      });
    }
  }
function wait ( msec ) { return waitTask ; function waitTask ( value ) { var that = this ; return new promisen . Promise ( function ( resolve ) { setTimeout ( function ( ) { resolve . call ( that , value ) ; } , msec ) ; } ) ; } }
creates a promise-returning function which does just sleep for given milliseconds.

@class promisen
@static
@function wait
@param msec {Number}
@returns {Function} promise-returning function
@example
var promisen = require("promisen");

var sleep = promisen.wait(1000); // 1 sec
sleep(value).then(function(value) {...});

// similar to below
setTimeout(function() {...}, 1000);
creates a promise - returning function which does just sleep for given milliseconds .