"use strict";


;(function ( root, name, definition ) {
  /*
   * Exports
   */
  if ( typeof define === 'function' && define.amd ) {
    define( [], definition );
  }
  else if ( typeof module === 'object' && module.exports ) {
    module.exports = definition();
  }
  else {
    root[ name ] = definition();
  }
})( this, 'crouch', function () {
  // /**
  //  * RegExp to find placeholders in the template
  //  *
  //  * http://regexr.com/3eveu
  //  * @type {RegExp}
  //  */
  // const _re = /{([0-9a-z_]+?)}/ig;


  /**
   * Micro template compiler
   *
   * @param {string} template
   * @param {array|object} values
   * @returns {string}
   */
  const crouch = ( template, values ) => {
    /*
     * Loop through all the placeholders that matched with regex
     */
    let match;
    while ( match = /{([0-9a-z_]+?)}/ig.exec( template ) ) {
      /*
       * Get value from given values and
       * if it doesn't exist use empty string
       */
      const _value = String( values[ match[ 1 ] ] || "" );

      /*
       * Replace the placeholder with a real value.
       */
      template = template.replace( match[ 0 ], _value )
    }

    /*
     * Return the template with filled in values
     */
    return template;
  };

  /**
   * 😎
   */
  return crouch;
} );

@@ -1023,25 +1023,24 @@
    /*%0A      
- 
 * Replace th
@@ -1074,28 +1074,105 @@
 alue.%0A      
- */%0A
+* Workaround for strings like %22$&%22%0A      */%0A      if ( _value%5B 0 %5D === '$' ) %7B%0A  
       templa
@@ -1205,16 +1205,22 @@
 ch%5B 0 %5D,
+ () =%3E
  _value 
@@ -1220,16 +1220,105 @@
 _value )
+;%0A      %7D%0A      else %7B%0A        template = template.replace( match%5B 0 %5D, _value );%0A      %7D
 %0A    %7D%0A%0A

Fix issue with "$&" as value