promisen.js
function top(array) {
    return topTask;

    function topTask() {
      var value = array[array.length - 1];
      return resolve(value);
    }
  }
function top(array) {
    return topTask;

    function topTask() {
      var value = array[array.length - 1];
      return resolve(value);
    }
  }
function top ( array ) { return topTask ; function topTask ( ) { var value = array [ array . length - 1 ] ; return resolve ( value ) ; } }
creates a promise-returning function which inspects the last value on the array.

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

var stack = ["foo", "bar"]; // stack is an array

var task2 = promisen(promisen.top(stack), task1);

task2().then(function() {...}); // stack.length == 2
creates a promise - returning function which inspects the last value on the array .