function runRejectableQueue(queue) {
  for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    args[_key - 1] = arguments[_key];
  }

  return new _Promise(function (resolve, reject) {
    var step = function step(index) {
      if (index >= queue.length) {
        resolve();
        return;
      }
      var result = isFunction(queue[index]) ? queue[index].apply(queue, _toConsumableArray(args)) : queue[index];
      if (result === false) return reject('stop');
      return _Promise.resolve(result).then(function () {
        return step(index + 1);
      }).catch(function (err) {
        return reject(err || 'stop');
      });
    };
    step(0);
  });
}
function runRejectableQueue(queue) {
  for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    args[_key - 1] = arguments[_key];
  }

  return new _Promise(function (resolve, reject) {
    var step = function step(index) {
      if (index >= queue.length) {
        resolve();
        return;
      }
      var result = isFunction(queue[index]) ? queue[index].apply(queue, _toConsumableArray(args)) : queue[index];
      if (result === false) return reject('stop');
      return _Promise.resolve(result).then(function () {
        return step(index + 1);
      }).catch(function (err) {
        return reject(err || 'stop');
      });
    };
    step(0);
  });
}
function runRejectableQueue ( queue ) { for ( var _len = arguments . length , args = Array ( _len > 1 ? _len - 1 : 0 ) , _key = 1 ; _key < _len ; _key ++ ) { args [ _key - 1 ] = arguments [ _key ] ; } return new _Promise ( function ( resolve , reject ) { var step = function step ( index ) { if ( index >= queue . length ) { resolve ( ) ; return ; } var result = isFunction ( queue [ index ] ) ? queue [ index ] . apply ( queue , _toConsumableArray ( args ) ) : queue [ index ] ; if ( result === false ) return reject ( 'stop' ) ; return _Promise . resolve ( result ) . then ( function ( ) { return step ( index + 1 ) ; } ) . catch ( function ( err ) { return reject ( err || 'stop' ) ; } ) ; } ; step ( 0 ) ; } ) ; }
run a queue one by one.If include function reject or return false it will stop
@param  {Array} queue the queue which we want to run one by one
@return {Promise}    tell us whether a queue run finished
run a queue one by one . If include function reject or return false it will stop