index.js
function chunks() {
  for (var
    update,
    out = [],
    updates = this.updates,
    template = this.chunks,
    callback = this.callback,
    all = Promise.resolve(template[0]),
    chain = function (after) {
      return all.then(function (through) {
                  notify(through);
                  return after;
                });
    },
    getSubValue = function (value) {
      if (isArray(value)) {
        value.forEach(getSubValue);
      } else {
        all = chain(
          Promise.resolve(value)
                 .then(resolveArray)
        );
      }
    },
    getValue = function (value) {
      if (isArray(value)) {
        var hc = Promise.resolve(createHyperComment());
        all = chain(hc);
        value.forEach(getSubValue);
        all = chain(hc);
      } else {
        all = chain(
          Promise.resolve(value)
                 .then(resolveAsTemplateValue(update))
                 .then(update === asTemplateValue ? identity : update)
        );
      }
    },
    notify = function (chunk) {
      out.push(chunk);
      callback(chunk);
    },
    i = 1,
    length = arguments.length; i < length; i++
  ) {
    update = updates[i - 1];
    getValue(arguments[i]);
    all = chain(template[i]);
  }
  return all.then(notify).then(function () { return out; });
}
function chunks() {
  for (var
    update,
    out = [],
    updates = this.updates,
    template = this.chunks,
    callback = this.callback,
    all = Promise.resolve(template[0]),
    chain = function (after) {
      return all.then(function (through) {
                  notify(through);
                  return after;
                });
    },
    getSubValue = function (value) {
      if (isArray(value)) {
        value.forEach(getSubValue);
      } else {
        all = chain(
          Promise.resolve(value)
                 .then(resolveArray)
        );
      }
    },
    getValue = function (value) {
      if (isArray(value)) {
        var hc = Promise.resolve(createHyperComment());
        all = chain(hc);
        value.forEach(getSubValue);
        all = chain(hc);
      } else {
        all = chain(
          Promise.resolve(value)
                 .then(resolveAsTemplateValue(update))
                 .then(update === asTemplateValue ? identity : update)
        );
      }
    },
    notify = function (chunk) {
      out.push(chunk);
      callback(chunk);
    },
    i = 1,
    length = arguments.length; i < length; i++
  ) {
    update = updates[i - 1];
    getValue(arguments[i]);
    all = chain(template[i]);
  }
  return all.then(notify).then(function () { return out; });
}
function chunks ( ) { for ( var update , out = [ ] , updates = this . updates , template = this . chunks , callback = this . callback , all = Promise . resolve ( template [ 0 ] ) , chain = function ( after ) { return all . then ( function ( through ) { notify ( through ) ; return after ; } ) ; } , getSubValue = function ( value ) { if ( isArray ( value ) ) { value . forEach ( getSubValue ) ; } else { all = chain ( Promise . resolve ( value ) . then ( resolveArray ) ) ; } } , getValue = function ( value ) { if ( isArray ( value ) ) { var hc = Promise . resolve ( createHyperComment ( ) ) ; all = chain ( hc ) ; value . forEach ( getSubValue ) ; all = chain ( hc ) ; } else { all = chain ( Promise . resolve ( value ) . then ( resolveAsTemplateValue ( update ) ) . then ( update === asTemplateValue ? identity : update ) ) ; } } , notify = function ( chunk ) { out . push ( chunk ) ; callback ( chunk ) ; } , i = 1 , length = arguments . length ; i < length ; i ++ ) { update = updates [ i - 1 ] ; getValue ( arguments [ i ] ) ; all = chain ( template [ i ] ) ; } return all . then ( notify ) . then ( function ( ) { return out ; } ) ; }
resolves through promises and invoke a notifier per each resolved chunk the context will be a viper
resolves through promises and invoke a notifier per each resolved chunk the context will be a viper