'use strict';

/** No serialization
  * @private
  * @param {*} a - Anything.
  * @return {*} a
  */
function _noSerialize(a) {
  return a;
}

// No engines
var ngn = [];

/** Compile a template object into an output source.
  * @name compile
  * @function
  * @param {Object} template - A template object.
  * @param {Object} [data] - Data to compile against the template.
  * @param {Object} [options] - Options for compiling.
  * @return {String} Compiled source.
  */

module.exports = function compile(template, data, options) {
  data = data || {};
  options = options || {};

  var res = '';
  var partials = template.partials;
  var expressions = template.expressions;
  var max = expressions ? expressions.length : 0;
  var engines = options.engines;
  var engmax = engines ? engines.length : 0;
  var serialize = options.serialize || _noSerialize;

  resolution: for (var i = 0; i < max; i++) {
    var expression = expressions[i];
    res += partials[i];

    for (var e = 0; e < engmax; e++) {
      var eng = engines[e](expression, data, template);
      if (eng) {
        res += serialize(eng);
        continue resolution;
      }
    }

    res += serialize(data[expression]);
  }

  res += partials[max];
  return res;
};

@@ -140,37 +140,8 @@
 %0A%7D%0A%0A
-// No engines%0Avar ngn = %5B%5D;%0A%0A
 /** 

Remove ngn from compile.js