example.js
function sequence(promises) {
  var result = Promise.resolve();
  promises.forEach(function(promise,i) {
    result = result.then(promise);
  });
  return result;
}
function sequence(promises) {
  var result = Promise.resolve();
  promises.forEach(function(promise,i) {
    result = result.then(promise);
  });
  return result;
}
function sequence ( promises ) { var result = Promise . resolve ( ) ; promises . forEach ( function ( promise , i ) { result = result . then ( promise ) ; } ) ; return result ; }
utility function to sequentialize promises
utility function to sequentialize promises