From 11bcc68071f6cd2c41c278055bc7988c7ba001d9 Mon Sep 17 00:00:00 2001 From: kazikai Date: Wed, 4 May 2016 15:24:09 +0900 Subject: [PATCH 1/2] Fix Comparsion Operation to Strict Equal --- lib/handlebars/runtime.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/handlebars/runtime.js b/lib/handlebars/runtime.js index 55eb1c1b0..00e4df64b 100644 --- a/lib/handlebars/runtime.js +++ b/lib/handlebars/runtime.js @@ -43,11 +43,11 @@ export function template(templateSpec, env) { partial = env.VM.resolvePartial.call(this, partial, context, options); let result = env.VM.invokePartial.call(this, partial, context, options); - if (result == null && env.compile) { + if (result === null && env.compile) { options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env); result = options.partials[options.name](context, options); } - if (result != null) { + if (result !== null) { if (options.indent) { let lines = result.split('\n'); for (let i = 0, l = lines.length; i < l; i++) { From 29a9473b42953913d4866344aa8338b6ae693682 Mon Sep 17 00:00:00 2001 From: kazikai Date: Wed, 4 May 2016 15:31:54 +0900 Subject: [PATCH 2/2] update to Fix Comparsion Operation to Strict Equal --- lib/handlebars/runtime.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/handlebars/runtime.js b/lib/handlebars/runtime.js index 00e4df64b..858353730 100644 --- a/lib/handlebars/runtime.js +++ b/lib/handlebars/runtime.js @@ -76,7 +76,7 @@ export function template(templateSpec, env) { lookup: function(depths, name) { const len = depths.length; for (let i = 0; i < len; i++) { - if (depths[i] && depths[i][name] != null) { + if (depths[i] && depths[i][name] !== null) { return depths[i][name]; } } @@ -137,7 +137,7 @@ export function template(templateSpec, env) { blockParams = templateSpec.useBlockParams ? [] : undefined; if (templateSpec.useDepths) { if (options.depths) { - depths = context != options.depths[0] ? [context].concat(options.depths) : options.depths; + depths = context !== options.depths[0] ? [context].concat(options.depths) : options.depths; } else { depths = [context]; } @@ -174,7 +174,7 @@ export function template(templateSpec, env) { export function wrapProgram(container, i, fn, data, declaredBlockParams, blockParams, depths) { function prog(context, options = {}) { let currentDepths = depths; - if (depths && context != depths[0]) { + if (depths && context !== depths[0]) { currentDepths = [context].concat(depths); }