promisen.js
function incr(array) {
    return incrTask;

    function incrTask() {
      if (!array.length) {
        Array.prototype.push.call(array, 0 | 0);
      }
      return resolve(++array[array.length - 1]);
    }
  }
function incr(array) {
    return incrTask;

    function incrTask() {
      if (!array.length) {
        Array.prototype.push.call(array, 0 | 0);
      }
      return resolve(++array[array.length - 1]);
    }
  }
function incr ( array ) { return incrTask ; function incrTask ( ) { if ( ! array . length ) { Array . prototype . push . call ( array , 0 | 0 ) ; } return resolve ( ++ array [ array . length - 1 ] ) ; } }
creates a promise-returning function which increments a counter on top of stack.

@class promisen
@static
@function incr
@param array {Array|Array-like} counter holder
@returns {Function} promise-returning function
@example
var promisen = require("promisen");

var counter = [123];
console.log("count: " + counter); // => count: 123

var incrTask = counter.incr();
incrTask().then(function(value) {...}); // => count: 124

// incrTask is available in a series of tasks.
var task = promisen(otherTask, incrTask);
creates a promise - returning function which increments a counter on top of stack .