summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/handlebars.js3
-rw-r--r--lib/handlebars/base.js9
-rw-r--r--lib/handlebars/compiler/ast.js2
-rw-r--r--lib/handlebars/compiler/compiler.js2
-rw-r--r--lib/handlebars/exception.js15
-rw-r--r--lib/handlebars/runtime.js3
-rw-r--r--lib/handlebars/utils.js13
7 files changed, 26 insertions, 21 deletions
diff --git a/lib/handlebars.js b/lib/handlebars.js
index dede1b8..72b4028 100644
--- a/lib/handlebars.js
+++ b/lib/handlebars.js
@@ -2,7 +2,8 @@ import { HandlebarsEnvironment, createFrame, logger, log } from "./handlebars/ba
// Each of these augment the Handlebars object. No need to setup here.
// (This is done to easily share code between commonjs and browse envs)
-import { SafeString, Exception, extend, escapeExpression, isEmpty } from "./handlebars/utils";
+import Exception from "./handlebars/exception";
+import { SafeString, extend, escapeExpression, isEmpty } from "./handlebars/utils";
import { compile, precompile } from "./handlebars/compiler/compiler";
import { template } from "./handlebars/runtime";
diff --git a/lib/handlebars/base.js b/lib/handlebars/base.js
index f4cb840..c83144a 100644
--- a/lib/handlebars/base.js
+++ b/lib/handlebars/base.js
@@ -1,6 +1,7 @@
/*jshint eqnull: true */
-import { Exception, extend, isEmpty } from "./utils";
+import { extend, isEmpty } from "./utils";
+import Exception from "./exception";
var K = function() { return this; };
@@ -19,9 +20,9 @@ var toString = Object.prototype.toString,
// Sourced from lodash
// https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
-function isFunction(value) {
+var isFunction = function(value) {
return typeof value === 'function';
-}
+};
// fallback for older versions of Chrome and Safari
if (isFunction(/x/)) {
isFunction = function(value) {
@@ -31,7 +32,7 @@ if (isFunction(/x/)) {
function isArray(value) {
return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false;
-};
+}
export function HandlebarsEnvironment(helpers, partials) {
this.helpers = helpers || {};
diff --git a/lib/handlebars/compiler/ast.js b/lib/handlebars/compiler/ast.js
index b61fa0e..c6c8993 100644
--- a/lib/handlebars/compiler/ast.js
+++ b/lib/handlebars/compiler/ast.js
@@ -1,4 +1,4 @@
-import { Exception } from "../utils";
+import Exception from "../exception";
var exports = {};
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js
index 6656a3f..c020e1f 100644
--- a/lib/handlebars/compiler/compiler.js
+++ b/lib/handlebars/compiler/compiler.js
@@ -1,4 +1,4 @@
-import { Exception } from "../utils";
+import Exception from "../exception";
import { template } from "../runtime";
import { parse } from "./base";
import { JavaScriptCompiler } from "./javascript-compiler";
diff --git a/lib/handlebars/exception.js b/lib/handlebars/exception.js
new file mode 100644
index 0000000..fc88534
--- /dev/null
+++ b/lib/handlebars/exception.js
@@ -0,0 +1,15 @@
+
+var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
+
+function Exception(message) {
+ var tmp = Error.prototype.constructor.apply(this, arguments);
+
+ // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
+ for (var idx = 0; idx < errorProps.length; idx++) {
+ this[errorProps[idx]] = tmp[errorProps[idx]];
+ }
+}
+
+Exception.prototype = new Error();
+
+export default Exception;
diff --git a/lib/handlebars/runtime.js b/lib/handlebars/runtime.js
index 4604312..55a5c6f 100644
--- a/lib/handlebars/runtime.js
+++ b/lib/handlebars/runtime.js
@@ -1,4 +1,5 @@
-import { escapeExpression, extend, Exception } from "./utils";
+import Exception from "./exception";
+import { escapeExpression, extend } from "./utils";
import { COMPILER_REVISION, REVISION_CHANGES } from "./base";
function checkRevision(compilerInfo) {
diff --git a/lib/handlebars/utils.js b/lib/handlebars/utils.js
index 458c46d..e3c2160 100644
--- a/lib/handlebars/utils.js
+++ b/lib/handlebars/utils.js
@@ -1,19 +1,6 @@
var toString = Object.prototype.toString,
isArray = Array.isArray;
-var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
-
-export function Exception(message) {
- var tmp = Error.prototype.constructor.apply(this, arguments);
-
- // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
- for (var idx = 0; idx < errorProps.length; idx++) {
- this[errorProps[idx]] = tmp[errorProps[idx]];
- }
-};
-
-Exception.prototype = new Error();
-
// Build out our basic SafeString type
export function SafeString(string) {
this.string = string;