Add strict equalities in src/display/api.js

This commit is contained in:
Jonas Jenwald 2014-08-01 12:39:31 +02:00
parent bdf1c513cf
commit a4b06d7a02

View File

@ -503,8 +503,7 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
// this call to render.
this.pendingDestroy = false;
var renderingIntent = ('intent' in params ?
(params.intent == 'print' ? 'print' : 'display') : 'display');
var renderingIntent = (params.intent === 'print' ? 'print' : 'display');
if (!this.intentStates[renderingIntent]) {
this.intentStates[renderingIntent] = {};
@ -1003,7 +1002,7 @@ var WorkerTransport = (function WorkerTransportClosure() {
messageHandler.on('JpegDecode', function(data) {
var imageUrl = data[0];
var components = data[1];
if (components != 3 && components != 1) {
if (components !== 3 && components !== 1) {
return Promise.reject(
new Error('Only 3 components or 1 component can be returned'));
}
@ -1022,13 +1021,13 @@ var WorkerTransport = (function WorkerTransportClosure() {
var data = tmpCtx.getImageData(0, 0, width, height).data;
var i, j;
if (components == 3) {
if (components === 3) {
for (i = 0, j = 0; i < rgbaLength; i += 4, j += 3) {
buf[j] = data[i];
buf[j + 1] = data[i + 1];
buf[j + 2] = data[i + 2];
}
} else if (components == 1) {
} else if (components === 1) {
for (i = 0, j = 0; i < rgbaLength; i += 4, j++) {
buf[j] = data[i];
}