[Pkg-javascript-commits] [pdf.js] 75/246: Add strict equalities in src/core/bidi.js
David Prévot
taffit at moszumanska.debian.org
Sun Sep 7 15:36:27 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 84503c656d7549b0a59f05e2e12ec7e67b47d171
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date: Fri Aug 1 18:24:12 2014 +0200
Add strict equalities in src/core/bidi.js
---
src/core/bidi.js | 55 ++++++++++++++++++++++++++++---------------------------
1 file changed, 28 insertions(+), 27 deletions(-)
diff --git a/src/core/bidi.js b/src/core/bidi.js
index a89e713..9d29692 100644
--- a/src/core/bidi.js
+++ b/src/core/bidi.js
@@ -78,7 +78,7 @@ var bidi = PDFJS.bidi = (function bidiClosure() {
function findUnequal(arr, start, value) {
for (var j = start, jj = arr.length; j < jj; ++j) {
- if (arr[j] != value) {
+ if (arr[j] !== value) {
return j;
}
}
@@ -138,7 +138,7 @@ var bidi = PDFJS.bidi = (function bidiClosure() {
} else if (0x0700 <= charCode && charCode <= 0x08AC) {
charType = 'AL';
}
- if (charType == 'R' || charType == 'AL' || charType == 'AN') {
+ if (charType === 'R' || charType === 'AL' || charType === 'AN') {
numBidi++;
}
types[i] = charType;
@@ -153,7 +153,7 @@ var bidi = PDFJS.bidi = (function bidiClosure() {
return createBidiText(str, isLTR);
}
- if (startLevel == -1) {
+ if (startLevel === -1) {
if ((strLength / numBidi) < 0.3) {
isLTR = true;
startLevel = 0;
@@ -182,7 +182,7 @@ var bidi = PDFJS.bidi = (function bidiClosure() {
*/
var lastType = sor;
for (i = 0; i < strLength; ++i) {
- if (types[i] == 'NSM') {
+ if (types[i] === 'NSM') {
types[i] = lastType;
} else {
lastType = types[i];
@@ -198,9 +198,9 @@ var bidi = PDFJS.bidi = (function bidiClosure() {
var t;
for (i = 0; i < strLength; ++i) {
t = types[i];
- if (t == 'EN') {
- types[i] = (lastType == 'AL') ? 'AN' : 'EN';
- } else if (t == 'R' || t == 'L' || t == 'AL') {
+ if (t === 'EN') {
+ types[i] = (lastType === 'AL') ? 'AN' : 'EN';
+ } else if (t === 'R' || t === 'L' || t === 'AL') {
lastType = t;
}
}
@@ -210,7 +210,7 @@ var bidi = PDFJS.bidi = (function bidiClosure() {
*/
for (i = 0; i < strLength; ++i) {
t = types[i];
- if (t == 'AL') {
+ if (t === 'AL') {
types[i] = 'R';
}
}
@@ -221,11 +221,12 @@ var bidi = PDFJS.bidi = (function bidiClosure() {
type changes to that type:
*/
for (i = 1; i < strLength - 1; ++i) {
- if (types[i] == 'ES' && types[i - 1] == 'EN' && types[i + 1] == 'EN') {
+ if (types[i] === 'ES' && types[i - 1] === 'EN' && types[i + 1] === 'EN') {
types[i] = 'EN';
}
- if (types[i] == 'CS' && (types[i - 1] == 'EN' || types[i - 1] == 'AN') &&
- types[i + 1] == types[i - 1]) {
+ if (types[i] === 'CS' &&
+ (types[i - 1] === 'EN' || types[i - 1] === 'AN') &&
+ types[i + 1] === types[i - 1]) {
types[i] = types[i - 1];
}
}
@@ -235,18 +236,18 @@ var bidi = PDFJS.bidi = (function bidiClosure() {
to all European numbers:
*/
for (i = 0; i < strLength; ++i) {
- if (types[i] == 'EN') {
+ if (types[i] === 'EN') {
// do before
var j;
for (j = i - 1; j >= 0; --j) {
- if (types[j] != 'ET') {
+ if (types[j] !== 'ET') {
break;
}
types[j] = 'EN';
}
// do after
for (j = i + 1; j < strLength; --j) {
- if (types[j] != 'ET') {
+ if (types[j] !== 'ET') {
break;
}
types[j] = 'EN';
@@ -259,7 +260,7 @@ var bidi = PDFJS.bidi = (function bidiClosure() {
*/
for (i = 0; i < strLength; ++i) {
t = types[i];
- if (t == 'WS' || t == 'ES' || t == 'ET' || t == 'CS') {
+ if (t === 'WS' || t === 'ES' || t === 'ET' || t === 'CS') {
types[i] = 'ON';
}
}
@@ -272,9 +273,9 @@ var bidi = PDFJS.bidi = (function bidiClosure() {
lastType = sor;
for (i = 0; i < strLength; ++i) {
t = types[i];
- if (t == 'EN') {
- types[i] = ((lastType == 'L') ? 'L' : 'EN');
- } else if (t == 'R' || t == 'L') {
+ if (t === 'EN') {
+ types[i] = ((lastType === 'L') ? 'L' : 'EN');
+ } else if (t === 'R' || t === 'L') {
lastType = t;
}
}
@@ -286,7 +287,7 @@ var bidi = PDFJS.bidi = (function bidiClosure() {
end-of-level-run (eor) are used at level run boundaries.
*/
for (i = 0; i < strLength; ++i) {
- if (types[i] == 'ON') {
+ if (types[i] === 'ON') {
var end = findUnequal(types, i + 1, 'ON');
var before = sor;
if (i > 0) {
@@ -297,13 +298,13 @@ var bidi = PDFJS.bidi = (function bidiClosure() {
if (end + 1 < strLength) {
after = types[end + 1];
}
- if (before != 'L') {
+ if (before !== 'L') {
before = 'R';
}
- if (after != 'L') {
+ if (after !== 'L') {
after = 'R';
}
- if (before == after) {
+ if (before === after) {
setValues(types, i, end, before);
}
i = end - 1; // reset to end (-1 so next iteration is ok)
@@ -314,7 +315,7 @@ var bidi = PDFJS.bidi = (function bidiClosure() {
N2. Any remaining neutrals take the embedding direction.
*/
for (i = 0; i < strLength; ++i) {
- if (types[i] == 'ON') {
+ if (types[i] === 'ON') {
types[i] = e;
}
}
@@ -329,13 +330,13 @@ var bidi = PDFJS.bidi = (function bidiClosure() {
for (i = 0; i < strLength; ++i) {
t = types[i];
if (isEven(levels[i])) {
- if (t == 'R') {
+ if (t === 'R') {
levels[i] += 1;
- } else if (t == 'AN' || t == 'EN') {
+ } else if (t === 'AN' || t === 'EN') {
levels[i] += 2;
}
} else { // isOdd
- if (t == 'L' || t == 'AN' || t == 'EN') {
+ if (t === 'L' || t === 'AN' || t === 'EN') {
levels[i] += 1;
}
}
@@ -414,7 +415,7 @@ var bidi = PDFJS.bidi = (function bidiClosure() {
var result = '';
for (i = 0, ii = chars.length; i < ii; ++i) {
var ch = chars[i];
- if (ch != '<' && ch != '>') {
+ if (ch !== '<' && ch !== '>') {
result += ch;
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list