lib/expression-compiler.js
function compile1(str) {
  if (!/[{}]/.exec(str)) return [literal(str)];

  var depth = 0;
  var nodes = [];
  var m;
  var buffer = '';

  while ((m = /[{}]/.exec(str)) && str.length > 0) {
    var chunk = str.substring(0, m.index);
    switch (m[0]) {
      case '{':
        depth += 1;
        if (depth === 1) {
          buffer += chunk;
          if (buffer.length > 0) nodes.push(literal(buffer));
          buffer = '';
        } else {
          buffer += chunk + '{';
        }
        break;
      case '}':
        depth -= 1;
        if (depth === 0) {
          buffer += chunk;
          if (buffer.length > 0) nodes.push(utils.parseExpression(buffer));
          buffer = '';
        } else {
          buffer += chunk + '}';
        }
        break;
    }
    str = str.substring(m.index + 1);
  }

  if (str.length > 0)
    nodes.push(literal(str));

  return nodes;
}
function compile1(str) {
  if (!/[{}]/.exec(str)) return [literal(str)];

  var depth = 0;
  var nodes = [];
  var m;
  var buffer = '';

  while ((m = /[{}]/.exec(str)) && str.length > 0) {
    var chunk = str.substring(0, m.index);
    switch (m[0]) {
      case '{':
        depth += 1;
        if (depth === 1) {
          buffer += chunk;
          if (buffer.length > 0) nodes.push(literal(buffer));
          buffer = '';
        } else {
          buffer += chunk + '{';
        }
        break;
      case '}':
        depth -= 1;
        if (depth === 0) {
          buffer += chunk;
          if (buffer.length > 0) nodes.push(utils.parseExpression(buffer));
          buffer = '';
        } else {
          buffer += chunk + '}';
        }
        break;
    }
    str = str.substring(m.index + 1);
  }

  if (str.length > 0)
    nodes.push(literal(str));

  return nodes;
}
function compile1 ( str ) { if ( ! / [{}] / . exec ( str ) ) return [ literal ( str ) ] ; var depth = 0 ; var nodes = [ ] ; var m ; var buffer = '' ; while ( ( m = / [{}] / . exec ( str ) ) && str . length > 0 ) { var chunk = str . substring ( 0 , m . index ) ; switch ( m [ 0 ] ) { case '{' : depth += 1 ; if ( depth === 1 ) { buffer += chunk ; if ( buffer . length > 0 ) nodes . push ( literal ( buffer ) ) ; buffer = '' ; } else { buffer += chunk + '{' ; } break ; case '}' : depth -= 1 ; if ( depth === 0 ) { buffer += chunk ; if ( buffer . length > 0 ) nodes . push ( utils . parseExpression ( buffer ) ) ; buffer = '' ; } else { buffer += chunk + '}' ; } break ; } str = str . substring ( m . index + 1 ) ; } if ( str . length > 0 ) nodes . push ( literal ( str ) ) ; return nodes ; }
Compile JS interpolations.

@param {String} str
Compile JS interpolations .