promisen.js
function pop(array) {
    return popTask;

    function popTask() {
      var value = Array.prototype.pop.call(array);
      return resolve(value);
    }
  }
function pop(array) {
    return popTask;

    function popTask() {
      var value = Array.prototype.pop.call(array);
      return resolve(value);
    }
  }
function pop ( array ) { return popTask ; function popTask ( ) { var value = Array . prototype . pop . call ( array ) ; return resolve ( value ) ; } }
creates a promise-returning function which fetches the last value on the array.

@class promisen
@static
@function pop
@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.pop(stack), task1);

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