From 8f5894d81af75217ea6b8a0d286d92705b9d82ad Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Fri, 1 Aug 2014 21:02:56 +0200 Subject: [PATCH] Add strict equalities in src/core/function.js --- src/core/function.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/core/function.js b/src/core/function.js index dd4507c31..e5e2922f8 100644 --- a/src/core/function.js +++ b/src/core/function.js @@ -173,7 +173,7 @@ var PDFFunction = (function PDFFunctionClosure() { //var mask = IR[8]; var range = IR[9]; - if (m != args.length) { + if (m !== args.length) { error('Incorrect number of arguments: ' + m + ' != ' + args.length); } @@ -275,7 +275,7 @@ var PDFFunction = (function PDFFunctionClosure() { var length = diff.length; return function constructInterpolatedFromIRResult(args) { - var x = n == 1 ? args[0] : Math.pow(args[0], n); + var x = (n === 1 ? args[0] : Math.pow(args[0], n)); var out = []; for (var j = 0; j < length; ++j) { @@ -295,7 +295,7 @@ var PDFFunction = (function PDFFunctionClosure() { } var inputSize = domain.length / 2; - if (inputSize != 1) { + if (inputSize !== 1) { error('Bad domain for stiched function'); } @@ -439,7 +439,7 @@ var PDFFunction = (function PDFFunctionClosure() { function isPDFFunction(v) { var fnDict; - if (typeof v != 'object') { + if (typeof v !== 'object') { return false; } else if (isDict(v)) { fnDict = v; @@ -513,7 +513,7 @@ var PostScriptEvaluator = (function PostScriptEvaluatorClosure() { var operator, a, b; while (counter < length) { operator = operators[counter++]; - if (typeof operator == 'number') { + if (typeof operator === 'number') { // Operator is really an operand and should be pushed to the stack. stack.push(operator); continue; @@ -594,7 +594,7 @@ var PostScriptEvaluator = (function PostScriptEvaluatorClosure() { case 'eq': b = stack.pop(); a = stack.pop(); - stack.push(a == b); + stack.push(a === b); break; case 'exch': stack.roll(2, 1); @@ -661,7 +661,7 @@ var PostScriptEvaluator = (function PostScriptEvaluatorClosure() { case 'ne': b = stack.pop(); a = stack.pop(); - stack.push(a != b); + stack.push(a !== b); break; case 'neg': a = stack.pop(); @@ -721,7 +721,7 @@ var PostScriptEvaluator = (function PostScriptEvaluatorClosure() { b = stack.pop(); a = stack.pop(); if (isBool(a) && isBool(b)) { - stack.push(a != b); + stack.push(a !== b); } else { stack.push(a ^ b); }