@@ -129,9 +129,9 @@ Ml_Bigarray.prototype.offset = function (arg) {
129
129
var ofs = 0 ;
130
130
if ( typeof arg === "number" ) arg = [ arg ] ;
131
131
if ( ! Array . isArray ( arg ) ) caml_invalid_argument ( "bigarray.js: invalid offset" ) ;
132
- if ( this . dims . length != arg . length )
132
+ if ( this . dims . length !== arg . length )
133
133
caml_invalid_argument ( "Bigarray.get/set: bad number of dimensions" ) ;
134
- if ( this . layout == 0 /* c_layout */ ) {
134
+ if ( this . layout === 0 /* c_layout */ ) {
135
135
for ( var i = 0 ; i < this . dims . length ; i ++ ) {
136
136
if ( arg [ i ] < 0 || arg [ i ] >= this . dims [ i ] ) caml_array_bound_error ( ) ;
137
137
ofs = ofs * this . dims [ i ] + arg [ i ] ;
@@ -191,11 +191,11 @@ Ml_Bigarray.prototype.fill = function (v) {
191
191
// Int64
192
192
var a = caml_int64_lo32 ( v ) ;
193
193
var b = caml_int64_hi32 ( v ) ;
194
- if ( a == b ) {
194
+ if ( a === b ) {
195
195
this . data . fill ( a ) ;
196
196
} else {
197
197
for ( var i = 0 ; i < this . data . length ; i ++ ) {
198
- this . data [ i ] = i % 2 == 0 ? a : b ;
198
+ this . data [ i ] = i % 2 === 0 ? a : b ;
199
199
}
200
200
}
201
201
break ;
@@ -204,11 +204,11 @@ Ml_Bigarray.prototype.fill = function (v) {
204
204
// Complex32, Complex64
205
205
var im = v [ 1 ] ;
206
206
var re = v [ 2 ] ;
207
- if ( im == re ) {
207
+ if ( im === re ) {
208
208
this . data . fill ( im ) ;
209
209
} else {
210
210
for ( var i = 0 ; i < this . data . length ; i ++ ) {
211
- this . data [ i ] = i % 2 == 0 ? im : re ;
211
+ this . data [ i ] = i % 2 === 0 ? im : re ;
212
212
}
213
213
}
214
214
break ;
@@ -219,16 +219,16 @@ Ml_Bigarray.prototype.fill = function (v) {
219
219
} ;
220
220
221
221
Ml_Bigarray . prototype . compare = function ( b , total ) {
222
- if ( this . layout != b . layout || this . kind != b . kind ) {
222
+ if ( this . layout !== b . layout || this . kind != = b . kind ) {
223
223
var k1 = this . kind | ( this . layout << 8 ) ;
224
224
var k2 = b . kind | ( b . layout << 8 ) ;
225
225
return k2 - k1 ;
226
226
}
227
- if ( this . dims . length != b . dims . length ) {
227
+ if ( this . dims . length !== b . dims . length ) {
228
228
return b . dims . length - this . dims . length ;
229
229
}
230
230
for ( var i = 0 ; i < this . dims . length ; i ++ )
231
- if ( this . dims [ i ] != b . dims [ i ] ) return this . dims [ i ] < b . dims [ i ] ? - 1 : 1 ;
231
+ if ( this . dims [ i ] !== b . dims [ i ] ) return this . dims [ i ] < b . dims [ i ] ? - 1 : 1 ;
232
232
switch ( this . kind ) {
233
233
case 0 :
234
234
case 1 :
@@ -241,7 +241,7 @@ Ml_Bigarray.prototype.compare = function (b, total) {
241
241
y = b . data [ i ] ;
242
242
if ( x < y ) return - 1 ;
243
243
if ( x > y ) return 1 ;
244
- if ( x != y ) {
244
+ if ( x !== y ) {
245
245
if ( ! total ) return Number . NaN ;
246
246
if ( ! Number . isNaN ( x ) ) return 1 ;
247
247
if ( ! Number . isNaN ( y ) ) return - 1 ;
@@ -287,7 +287,7 @@ function Ml_Bigarray_c_1_1(kind, layout, dims, buffer) {
287
287
Ml_Bigarray_c_1_1 . prototype = new Ml_Bigarray ( ) ;
288
288
Ml_Bigarray_c_1_1 . prototype . offset = function ( arg ) {
289
289
if ( typeof arg !== "number" ) {
290
- if ( Array . isArray ( arg ) && arg . length == 1 ) arg = arg [ 0 ] ;
290
+ if ( Array . isArray ( arg ) && arg . length === 1 ) arg = arg [ 0 ] ;
291
291
else caml_invalid_argument ( "Ml_Bigarray_c_1_1.offset" ) ;
292
292
}
293
293
if ( arg < 0 || arg >= this . dims [ 0 ] ) caml_array_bound_error ( ) ;
@@ -318,13 +318,13 @@ function caml_ba_compare(a, b, total) {
318
318
//Requires: caml_invalid_argument
319
319
function caml_ba_create_unsafe ( kind , layout , dims , data ) {
320
320
var size_per_element = caml_ba_get_size_per_element ( kind ) ;
321
- if ( caml_ba_get_size ( dims ) * size_per_element != data . length ) {
321
+ if ( caml_ba_get_size ( dims ) * size_per_element !== data . length ) {
322
322
caml_invalid_argument ( "length doesn't match dims" ) ;
323
323
}
324
324
if (
325
- layout == 0 && // c_layout
326
- dims . length == 1 && // Array1
327
- size_per_element == 1
325
+ layout === 0 && // c_layout
326
+ dims . length === 1 && // Array1
327
+ size_per_element === 1
328
328
)
329
329
// 1-to-1 mapping
330
330
return new Ml_Bigarray_c_1_1 ( kind , layout , dims , data ) ;
@@ -344,7 +344,7 @@ function caml_ba_create(kind, layout, dims_ml) {
344
344
//Provides: caml_ba_change_layout
345
345
//Requires: caml_ba_create_unsafe
346
346
function caml_ba_change_layout ( ba , layout ) {
347
- if ( ba . layout == layout ) return ba ;
347
+ if ( ba . layout === layout ) return ba ;
348
348
var new_dims = [ ] ;
349
349
for ( var i = 0 ; i < ba . dims . length ; i ++ )
350
350
new_dims [ i ] = ba . dims [ ba . dims . length - i - 1 ] ;
@@ -517,10 +517,10 @@ function caml_ba_fill(ba, v) {
517
517
//Provides: caml_ba_blit
518
518
//Requires: caml_invalid_argument
519
519
function caml_ba_blit ( src , dst ) {
520
- if ( dst . dims . length != src . dims . length )
520
+ if ( dst . dims . length !== src . dims . length )
521
521
caml_invalid_argument ( "Bigarray.blit: dimension mismatch" ) ;
522
522
for ( var i = 0 ; i < dst . dims . length ; i ++ )
523
- if ( dst . dims [ i ] != src . dims [ i ] )
523
+ if ( dst . dims [ i ] !== src . dims [ i ] )
524
524
caml_invalid_argument ( "Bigarray.blit: dimension mismatch" ) ;
525
525
dst . data . set ( src . data ) ;
526
526
return 0 ;
@@ -532,7 +532,7 @@ function caml_ba_blit(src, dst) {
532
532
function caml_ba_sub ( ba , ofs , len ) {
533
533
var changed_dim ;
534
534
var mul = 1 ;
535
- if ( ba . layout == 0 ) {
535
+ if ( ba . layout === 0 ) {
536
536
for ( var i = 1 ; i < ba . dims . length ; i ++ ) mul = mul * ba . dims [ i ] ;
537
537
changed_dim = 0 ;
538
538
} else {
@@ -565,7 +565,7 @@ function caml_ba_slice(ba, vind) {
565
565
caml_invalid_argument ( "Bigarray.slice: too many indices" ) ;
566
566
567
567
// Compute offset and check bounds
568
- if ( ba . layout == 0 ) {
568
+ if ( ba . layout === 0 ) {
569
569
for ( var i = 0 ; i < num_inds ; i ++ ) index [ i ] = vind [ i ] ;
570
570
for ( ; i < ba . dims . length ; i ++ ) index [ i ] = 0 ;
571
571
sub_dims = ba . dims . slice ( num_inds ) ;
@@ -605,7 +605,7 @@ function caml_ba_reshape(ba, vind) {
605
605
606
606
var size = caml_ba_get_size ( ba . dims ) ;
607
607
// Check that sizes agree
608
- if ( num_elts != size )
608
+ if ( num_elts !== size )
609
609
caml_invalid_argument ( "Bigarray.reshape: size mismatch" ) ;
610
610
return caml_ba_create_unsafe ( ba . kind , ba . layout , new_dim , ba . data ) ;
611
611
}
@@ -616,7 +616,7 @@ function caml_ba_reshape(ba, vind) {
616
616
function caml_ba_serialize ( writer , ba , sz ) {
617
617
writer . write ( 32 , ba . dims . length ) ;
618
618
writer . write ( 32 , ba . kind | ( ba . layout << 8 ) ) ;
619
- if ( ba . caml_custom == "_bigarr02" )
619
+ if ( ba . caml_custom === "_bigarr02" )
620
620
for ( var i = 0 ; i < ba . dims . length ; i ++ ) {
621
621
if ( ba . dims [ i ] < 0xffff ) writer . write ( 16 , ba . dims [ i ] ) ;
622
622
else {
@@ -705,13 +705,13 @@ function caml_ba_deserialize(reader, sz, name) {
705
705
var kind = tag & 0xff ;
706
706
var layout = ( tag >> 8 ) & 1 ;
707
707
var dims = [ ] ;
708
- if ( name == "_bigarr02" )
708
+ if ( name === "_bigarr02" )
709
709
for ( var i = 0 ; i < num_dims ; i ++ ) {
710
710
var size_dim = reader . read16u ( ) ;
711
- if ( size_dim == 0xffff ) {
711
+ if ( size_dim === 0xffff ) {
712
712
var size_dim_hi = reader . read32u ( ) ;
713
713
var size_dim_lo = reader . read32u ( ) ;
714
- if ( size_dim_hi != 0 )
714
+ if ( size_dim_hi !== 0 )
715
715
caml_failwith ( "input_value: bigarray dimension overflow in 32bit" ) ;
716
716
size_dim = size_dim_lo ;
717
717
}
@@ -807,7 +807,7 @@ function caml_ba_deserialize(reader, sz, name) {
807
807
//Provides: caml_ba_create_from
808
808
//Requires: caml_ba_create_unsafe, caml_invalid_argument, caml_ba_get_size_per_element
809
809
function caml_ba_create_from ( data1 , data2 , jstyp , kind , layout , dims ) {
810
- if ( data2 || caml_ba_get_size_per_element ( kind ) == 2 ) {
810
+ if ( data2 || caml_ba_get_size_per_element ( kind ) === 2 ) {
811
811
caml_invalid_argument (
812
812
"caml_ba_create_from: use return caml_ba_create_unsafe" ,
813
813
) ;
@@ -859,7 +859,7 @@ function caml_ba_hash(ba) {
859
859
w = ba . data [ i + 0 ] | ( ba . data [ i + 1 ] << 16 ) ;
860
860
h = caml_hash_mix_int ( h , w ) ;
861
861
}
862
- if ( ( num_elts & 1 ) != 0 ) h = caml_hash_mix_int ( h , ba . data [ i ] ) ;
862
+ if ( ( num_elts & 1 ) !== 0 ) h = caml_hash_mix_int ( h , ba . data [ i ] ) ;
863
863
break ;
864
864
case 6 : // Int32Array (int32)
865
865
if ( num_elts > 64 ) num_elts = 64 ;
0 commit comments