{"size": 1403, "ext": "js", "max_stars_repo_path": "test/input/lib/handlebars-ext.js", "max_stars_repo_name": "CrocInc/grunt-croc-requirejs", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/input/lib/handlebars-ext.js", "max_issues_repo_name": "CrocInc/grunt-croc-requirejs", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/input/lib/handlebars-ext.js", "max_forks_repo_name": "CrocInc/grunt-croc-requirejs", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 35.075, "max_line_length": 127, "alphanum_fraction": 0.6507483963}
define([
	"handlebars"
], function (Handlebars) {
	"use strict";

	/**
	 * Extending Handlebars compiler for adding support of functions inside templates.
	 *
	 * This code is required at development-runtime and build-time (only on prepare stage).
	 * Also it MAY be required at production-runtime if an application uses dynamic templates compilation.
	 * Because of this the compiler extensions is kept (not stripped out during building) but checks JavaScriptCompiler.
	 * If an app currently uses handlebars.runtime then JavaScriptCompiler will be undefined.
	 * @param parent
	 * @param name
	 * @param type
	 * @returns {string}
	 */
	if (Handlebars.JavaScriptCompiler) {
		Handlebars.JavaScriptCompiler.prototype.nameLookup = function (parent, name, type) {
			if (parent === "helpers") {
				if (Handlebars.JavaScriptCompiler.isValidJavaScriptVariableName(name))
					return parent + "." + name;
				else
					return parent + "['" + name + "']";
			}

			if (/^[0-9]+$/.test(name)) {
				return parent + "[" + name + "]";
			} else if (Handlebars.JavaScriptCompiler.isValidJavaScriptVariableName(name)) {
				// ( typeof parent.name === "function" ? parent.name() : parent.name)
				return "(typeof " + parent + "." + name + " === 'function' ? " + parent + "." + name + "() : " + parent + "." + name + ")";
			} else {
				return parent + "['" + name + "']";
			}
		};
	}

	return Handlebars;

});