summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/base.js
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2013-07-24 05:03:27 +0000
committerYehuda Katz <wycats@gmail.com>2013-07-24 05:03:27 +0000
commitf5c8484ea0c1ac1aec6994ad3b5928fb67b7aa62 (patch)
tree8e92df6cccab8ff4da78c11d90d4e534a19374b8 /lib/handlebars/base.js
parentda130f7745fc338d7ea31c60d9954ab6e0e1511a (diff)
downloadhandlebars.js-f5c8484ea0c1ac1aec6994ad3b5928fb67b7aa62.zip
handlebars.js-f5c8484ea0c1ac1aec6994ad3b5928fb67b7aa62.tar.gz
handlebars.js-f5c8484ea0c1ac1aec6994ad3b5928fb67b7aa62.tar.bz2
Further progress towards modularization.
At this point, I have only 2 fails in the Node build, but I'm doing a bunch of manual stuff locally and still have a bunch of hacks.
Diffstat (limited to 'lib/handlebars/base.js')
-rw-r--r--lib/handlebars/base.js26
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/handlebars/base.js b/lib/handlebars/base.js
index 875fe03..0e3383e 100644
--- a/lib/handlebars/base.js
+++ b/lib/handlebars/base.js
@@ -1,13 +1,13 @@
/*jshint eqnull: true */
-import { Exception, extend } from "handlebars/utils";
+import { Exception, extend } from "./utils";
var K = function() { return this; };
-export VERSION = "1.0.0";
-export COMPILER_REVISION = 4;
+export var VERSION = "1.0.0";
+export var COMPILER_REVISION = 4;
-export REVISION_CHANGES = {
+export var REVISION_CHANGES = {
1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it
2: '== 1.0.0-rc.3',
3: '== 1.0.0-rc.4',
@@ -19,15 +19,17 @@ export function base(helpers, partials) {
var exports = {};
+ var helpers = helpers || {};
+ var partials = partials || {};
- helpers = helpers || {};
- partials = partials || {};
+ exports.helpers = helpers;
+ exports.partials = partials;
var toString = Object.prototype.toString,
functionType = '[object Function]',
objectType = '[object Object]';
- exports.registerHelper(name, fn, inverse) {
+ exports.registerHelper = function(name, fn, inverse) {
if (toString.call(name) === objectType) {
if (inverse || fn) { throw new Exception('Arg not supported with multiple helpers'); }
extend(helpers, name);
@@ -37,7 +39,7 @@ export function base(helpers, partials) {
}
};
- exports.registerPartial(name, str) {
+ exports.registerPartial = function(name, str) {
if (toString.call(name) === objectType) {
extend(partials, name);
} else {
@@ -83,7 +85,7 @@ export function base(helpers, partials) {
if(type === functionType) { context = context.call(this); }
if (options.data) {
- data = Handlebars.createFrame(options.data);
+ data = createFrame(options.data);
}
if(context && typeof context === 'object') {
@@ -137,7 +139,7 @@ export function base(helpers, partials) {
Handlebars.log(level, context);
});
- return Handlebars;
+ return exports;
}
var levels = {
@@ -146,7 +148,7 @@ var levels = {
var methodMap = { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' };
-export logger = {
+export var logger = {
// can be overridden in the host environment
log: function(level, obj) {
if (Handlebars.logger.level <= level) {
@@ -160,7 +162,7 @@ export logger = {
export function log(level, obj) { logger.log(level, obj); };
-export createFrame = Object.create || function(object) {
+export var createFrame = Object.create || function(object) {
K.prototype = object;
var obj = new K();
K.prototype = null;