lib/index.js
/**
		 * Compile accepts a string which may contain evaluation <% %> or interpolation <%= %> tokens.
		 * it Returns a template function which accepts an optional data object which will be bound to the context,
		 * and will return a rendered string once invoked.
		 *
		 *
		 * DISCLAIMER: this is all very beginning, and right now focused on readability to understand how things work/will work
		 *
		 * @param str
		 * @returns {Function}
		 */
Compile accepts a string which may contain evaluation <% %> or interpolation <%= %> tokens.
it Returns a template function which accepts an optional data object which will be bound to the context,
and will return a rendered string once invoked.

this is all very beginning, and right now focused on readability to understand how things work/will work

@param str
@returns {Function}
Compile accepts a string which may contain evaluation <% % > or interpolation <% = % > tokens . it Returns a template function which accepts an optional data object which will be bound to the context and will return a rendered string once invoked . this is all very beginning and right now focused on readability to understand how things work / will work @param str @returns { Function }
static compile(str = '') {
			let regex = this._newRegex();
			let stringLength = str.length;
			let targetFunctionArr = [];
			let cursor = 0;
			let regexResults;
			let functionText = [];
			while ((regexResults = regex.exec(str)) !== null) {
				targetFunctionArr.push({
					portion: str.substring(cursor, regexResults.index),
					cursor: cursor,
					result: regexResults[0],
					strippedResult: regexResults[2],
					next: regex.lastIndex
				});
				cursor = regex.lastIndex;
			}
			if (regexResults === null) {
				targetFunctionArr.push({
					portion: str.substring(targetFunctionArr[targetFunctionArr.length - 1] && targetFunctionArr[targetFunctionArr.length - 1].next || 0, stringLength)
				});
			}
			functionText.push("var str = '';\n");
			targetFunctionArr.forEach((result) => {
				if (result['portion']) {
					functionText += 'str = str + `' + result['portion'] + '`;\n';
				}
				if (result['result']) {
					if (result['result'][2] === '=') { 
						functionText += "str = str + " + result['strippedResult'] + ";\n";
					} else {
						functionText += result['strippedResult'] + '\n';
					}
				}
			});
			functionText += '\nreturn str;';
			return new Function(functionText);
		}
static compile ( str = '' ) { let regex = this . _newRegex ( ) ; let stringLength = str . length ; let targetFunctionArr = [ ] ; let cursor = 0 ; let regexResults ; let functionText = [ ] ; while ( ( regexResults = regex . exec ( str ) ) !== null ) { targetFunctionArr . push ( { portion : str . substring ( cursor , regexResults . index ) , cursor : cursor , result : regexResults [ 0 ] , strippedResult : regexResults [ 2 ] , next : regex . lastIndex } ) ; cursor = regex . lastIndex ; } if ( regexResults === null ) { targetFunctionArr . push ( { portion : str . substring ( targetFunctionArr [ targetFunctionArr . length - 1 ] && targetFunctionArr [ targetFunctionArr . length - 1 ] . next || 0 , stringLength ) } ) ; } functionText . push ( "var str = '';\n" ) ; targetFunctionArr . forEach ( ( result ) => { if ( result [ 'portion' ] ) { functionText += 'str = str + `' + result [ 'portion' ] + '`;\n' ; } if ( result [ 'result' ] ) { if ( result [ 'result' ] [ 2 ] === '=' ) { functionText += "str = str + " + result [ 'strippedResult' ] + ";\n" ; } else { functionText += result [ 'strippedResult' ] + '\n' ; } } } ) ; functionText += '\nreturn str;' ; return new Function ( functionText ) ; }
Compile accepts a string which may contain evaluation <% %> or interpolation <%= %> tokens.
Compile accepts a string which may contain evaluation <% % > or interpolation <% = % > tokens .
//TODO: Is right? should maintain readability but be recursive //TODO: Ugly, make it reasonable /**
			 * Construct function
			 */ /**
				 * Normal text? we add it to the string.
				 */ /**
				 * Token? We need to execute it according in conjunction with the potential data object
				 */ //Is it interpolation? else a function; //TODO: Create an interpolation object.. so we can change token wrappers // TODO: change this check to reflecg a regex group /**
			 * Todo: implement caching for reusability and change += coercion operators to array.push.join for performance optimization
			 * @type {string}
			 */