lib/index.js
function Combyne(template, data) {
    // Allow this method to run standalone.
    if (!(this instanceof Combyne)) {
      return new Combyne(template, data);
    }

    // Expose the template for easier accessing and mutation.
    this.template = template;

    // Default the data to an empty object.
    this.data = data || {};

    // Internal use only.  Stores the partials and filters.
    this._partials = {};
    this._filters = {};

    // Ensure the template is a String.
    if (type(this.template) !== "string") {
      throw new Error("Template must be a String.");
    }

    // Normalize the delimiters with the defaults, to ensure a full object.
    var delimiters = defaults(Combyne.settings.delimiters, defaultDelimiters);

    // Create a new grammar with the delimiters.
    var grammar = new Grammar(delimiters).escape();

    // Break down the template into a series of tokens.
    var stack = new Tokenizer(this.template, grammar).parse();

    // Take the stack and create something resembling an AST.
    var tree = new Tree(stack).make();

    // Expose the internal tree and stack.
    this.tree = tree;
    this.stack = stack;

    // Compile the template function from the tree.
    this.compiler = new Compiler(tree);

    // Update the source.
    this.source = this.compiler.source;
  }
function Combyne(template, data) {
    // Allow this method to run standalone.
    if (!(this instanceof Combyne)) {
      return new Combyne(template, data);
    }

    // Expose the template for easier accessing and mutation.
    this.template = template;

    // Default the data to an empty object.
    this.data = data || {};

    // Internal use only.  Stores the partials and filters.
    this._partials = {};
    this._filters = {};

    // Ensure the template is a String.
    if (type(this.template) !== "string") {
      throw new Error("Template must be a String.");
    }

    // Normalize the delimiters with the defaults, to ensure a full object.
    var delimiters = defaults(Combyne.settings.delimiters, defaultDelimiters);

    // Create a new grammar with the delimiters.
    var grammar = new Grammar(delimiters).escape();

    // Break down the template into a series of tokens.
    var stack = new Tokenizer(this.template, grammar).parse();

    // Take the stack and create something resembling an AST.
    var tree = new Tree(stack).make();

    // Expose the internal tree and stack.
    this.tree = tree;
    this.stack = stack;

    // Compile the template function from the tree.
    this.compiler = new Compiler(tree);

    // Update the source.
    this.source = this.compiler.source;
  }
function Combyne ( template , data ) { // Allow this method to run standalone. if ( ! ( this instanceof Combyne ) ) { return new Combyne ( template , data ) ; } // Expose the template for easier accessing and mutation. this . template = template ; // Default the data to an empty object. this . data = data || { } ; // Internal use only.  Stores the partials and filters. this . _partials = { } ; this . _filters = { } ; // Ensure the template is a String. if ( type ( this . template ) !== "string" ) { throw new Error ( "Template must be a String." ) ; } // Normalize the delimiters with the defaults, to ensure a full object. var delimiters = defaults ( Combyne . settings . delimiters , defaultDelimiters ) ; // Create a new grammar with the delimiters. var grammar = new Grammar ( delimiters ) . escape ( ) ; // Break down the template into a series of tokens. var stack = new Tokenizer ( this . template , grammar ) . parse ( ) ; // Take the stack and create something resembling an AST. var tree = new Tree ( stack ) . make ( ) ; // Expose the internal tree and stack. this . tree = tree ; this . stack = stack ; // Compile the template function from the tree. this . compiler = new Compiler ( tree ) ; // Update the source. this . source = this . compiler . source ; }
Represents a Combyne template.

@class Combyne
@param {string} template - The template to compile.
@param {object} data - Optional data to compile.
@memberOf module:index
Represents a Combyne template .