updated indentation to 2-spaces. Added some {} around if/else 1-liners expressions.
This commit is contained in:
parent
b0f828d8ad
commit
f620a1de51
|
@ -54,20 +54,23 @@ UTF_32.prototype.match = function(det) {
|
||||||
hasBOM = false,
|
hasBOM = false,
|
||||||
confidence = 0;
|
confidence = 0;
|
||||||
|
|
||||||
if (limit == 0)
|
if (limit == 0) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.getChar(input, 0) == 0x0000FEFF)
|
if (this.getChar(input, 0) == 0x0000FEFF) {
|
||||||
hasBOM = true;
|
hasBOM = true;
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < limit; i += 4) {
|
for (var i = 0; i < limit; i += 4) {
|
||||||
var ch = this.getChar(input, i);
|
var ch = this.getChar(input, i);
|
||||||
|
|
||||||
if (ch < 0 || ch >= 0x10FFFF || (ch >= 0xD800 && ch <= 0xDFFF))
|
if (ch < 0 || ch >= 0x10FFFF || (ch >= 0xD800 && ch <= 0xDFFF)) {
|
||||||
numInvalid += 1;
|
numInvalid += 1;
|
||||||
else
|
} else {
|
||||||
numValid += 1;
|
numValid += 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Cook up some sort of confidence score, based on presence of a BOM
|
// Cook up some sort of confidence score, based on presence of a BOM
|
||||||
// and the existence of valid and/or invalid multi-byte sequences.
|
// and the existence of valid and/or invalid multi-byte sequences.
|
||||||
|
|
Loading…
Reference in New Issue