@@ -129,9 +129,9 @@ Ml_Bigarray.prototype.offset = function (arg) {
129129 var ofs = 0 ;
130130 if ( typeof arg === "number" ) arg = [ arg ] ;
131131 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 )
133133 caml_invalid_argument ( "Bigarray.get/set: bad number of dimensions" ) ;
134- if ( this . layout == 0 /* c_layout */ ) {
134+ if ( this . layout === 0 /* c_layout */ ) {
135135 for ( var i = 0 ; i < this . dims . length ; i ++ ) {
136136 if ( arg [ i ] < 0 || arg [ i ] >= this . dims [ i ] ) caml_array_bound_error ( ) ;
137137 ofs = ofs * this . dims [ i ] + arg [ i ] ;
@@ -191,11 +191,11 @@ Ml_Bigarray.prototype.fill = function (v) {
191191 // Int64
192192 var a = caml_int64_lo32 ( v ) ;
193193 var b = caml_int64_hi32 ( v ) ;
194- if ( a == b ) {
194+ if ( a === b ) {
195195 this . data . fill ( a ) ;
196196 } else {
197197 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 ;
199199 }
200200 }
201201 break ;
@@ -204,11 +204,11 @@ Ml_Bigarray.prototype.fill = function (v) {
204204 // Complex32, Complex64
205205 var im = v [ 1 ] ;
206206 var re = v [ 2 ] ;
207- if ( im == re ) {
207+ if ( im === re ) {
208208 this . data . fill ( im ) ;
209209 } else {
210210 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 ;
212212 }
213213 }
214214 break ;
@@ -219,16 +219,16 @@ Ml_Bigarray.prototype.fill = function (v) {
219219} ;
220220
221221Ml_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 ) {
223223 var k1 = this . kind | ( this . layout << 8 ) ;
224224 var k2 = b . kind | ( b . layout << 8 ) ;
225225 return k2 - k1 ;
226226 }
227- if ( this . dims . length != b . dims . length ) {
227+ if ( this . dims . length !== b . dims . length ) {
228228 return b . dims . length - this . dims . length ;
229229 }
230230 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 ;
232232 switch ( this . kind ) {
233233 case 0 :
234234 case 1 :
@@ -241,7 +241,7 @@ Ml_Bigarray.prototype.compare = function (b, total) {
241241 y = b . data [ i ] ;
242242 if ( x < y ) return - 1 ;
243243 if ( x > y ) return 1 ;
244- if ( x != y ) {
244+ if ( x !== y ) {
245245 if ( ! total ) return Number . NaN ;
246246 if ( ! Number . isNaN ( x ) ) return 1 ;
247247 if ( ! Number . isNaN ( y ) ) return - 1 ;
@@ -287,7 +287,7 @@ function Ml_Bigarray_c_1_1(kind, layout, dims, buffer) {
287287Ml_Bigarray_c_1_1 . prototype = new Ml_Bigarray ( ) ;
288288Ml_Bigarray_c_1_1 . prototype . offset = function ( arg ) {
289289 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 ] ;
291291 else caml_invalid_argument ( "Ml_Bigarray_c_1_1.offset" ) ;
292292 }
293293 if ( arg < 0 || arg >= this . dims [ 0 ] ) caml_array_bound_error ( ) ;
@@ -318,13 +318,13 @@ function caml_ba_compare(a, b, total) {
318318//Requires: caml_invalid_argument
319319function caml_ba_create_unsafe ( kind , layout , dims , data ) {
320320 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 ) {
322322 caml_invalid_argument ( "length doesn't match dims" ) ;
323323 }
324324 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
328328 )
329329 // 1-to-1 mapping
330330 return new Ml_Bigarray_c_1_1 ( kind , layout , dims , data ) ;
@@ -344,7 +344,7 @@ function caml_ba_create(kind, layout, dims_ml) {
344344//Provides: caml_ba_change_layout
345345//Requires: caml_ba_create_unsafe
346346function caml_ba_change_layout ( ba , layout ) {
347- if ( ba . layout == layout ) return ba ;
347+ if ( ba . layout === layout ) return ba ;
348348 var new_dims = [ ] ;
349349 for ( var i = 0 ; i < ba . dims . length ; i ++ )
350350 new_dims [ i ] = ba . dims [ ba . dims . length - i - 1 ] ;
@@ -517,10 +517,10 @@ function caml_ba_fill(ba, v) {
517517//Provides: caml_ba_blit
518518//Requires: caml_invalid_argument
519519function caml_ba_blit ( src , dst ) {
520- if ( dst . dims . length != src . dims . length )
520+ if ( dst . dims . length !== src . dims . length )
521521 caml_invalid_argument ( "Bigarray.blit: dimension mismatch" ) ;
522522 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 ] )
524524 caml_invalid_argument ( "Bigarray.blit: dimension mismatch" ) ;
525525 dst . data . set ( src . data ) ;
526526 return 0 ;
@@ -532,7 +532,7 @@ function caml_ba_blit(src, dst) {
532532function caml_ba_sub ( ba , ofs , len ) {
533533 var changed_dim ;
534534 var mul = 1 ;
535- if ( ba . layout == 0 ) {
535+ if ( ba . layout === 0 ) {
536536 for ( var i = 1 ; i < ba . dims . length ; i ++ ) mul = mul * ba . dims [ i ] ;
537537 changed_dim = 0 ;
538538 } else {
@@ -565,7 +565,7 @@ function caml_ba_slice(ba, vind) {
565565 caml_invalid_argument ( "Bigarray.slice: too many indices" ) ;
566566
567567 // Compute offset and check bounds
568- if ( ba . layout == 0 ) {
568+ if ( ba . layout === 0 ) {
569569 for ( var i = 0 ; i < num_inds ; i ++ ) index [ i ] = vind [ i ] ;
570570 for ( ; i < ba . dims . length ; i ++ ) index [ i ] = 0 ;
571571 sub_dims = ba . dims . slice ( num_inds ) ;
@@ -605,7 +605,7 @@ function caml_ba_reshape(ba, vind) {
605605
606606 var size = caml_ba_get_size ( ba . dims ) ;
607607 // Check that sizes agree
608- if ( num_elts != size )
608+ if ( num_elts !== size )
609609 caml_invalid_argument ( "Bigarray.reshape: size mismatch" ) ;
610610 return caml_ba_create_unsafe ( ba . kind , ba . layout , new_dim , ba . data ) ;
611611}
@@ -616,7 +616,7 @@ function caml_ba_reshape(ba, vind) {
616616function caml_ba_serialize ( writer , ba , sz ) {
617617 writer . write ( 32 , ba . dims . length ) ;
618618 writer . write ( 32 , ba . kind | ( ba . layout << 8 ) ) ;
619- if ( ba . caml_custom == "_bigarr02" )
619+ if ( ba . caml_custom === "_bigarr02" )
620620 for ( var i = 0 ; i < ba . dims . length ; i ++ ) {
621621 if ( ba . dims [ i ] < 0xffff ) writer . write ( 16 , ba . dims [ i ] ) ;
622622 else {
@@ -705,13 +705,13 @@ function caml_ba_deserialize(reader, sz, name) {
705705 var kind = tag & 0xff ;
706706 var layout = ( tag >> 8 ) & 1 ;
707707 var dims = [ ] ;
708- if ( name == "_bigarr02" )
708+ if ( name === "_bigarr02" )
709709 for ( var i = 0 ; i < num_dims ; i ++ ) {
710710 var size_dim = reader . read16u ( ) ;
711- if ( size_dim == 0xffff ) {
711+ if ( size_dim === 0xffff ) {
712712 var size_dim_hi = reader . read32u ( ) ;
713713 var size_dim_lo = reader . read32u ( ) ;
714- if ( size_dim_hi != 0 )
714+ if ( size_dim_hi !== 0 )
715715 caml_failwith ( "input_value: bigarray dimension overflow in 32bit" ) ;
716716 size_dim = size_dim_lo ;
717717 }
@@ -807,7 +807,7 @@ function caml_ba_deserialize(reader, sz, name) {
807807//Provides: caml_ba_create_from
808808//Requires: caml_ba_create_unsafe, caml_invalid_argument, caml_ba_get_size_per_element
809809function 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 ) {
811811 caml_invalid_argument (
812812 "caml_ba_create_from: use return caml_ba_create_unsafe" ,
813813 ) ;
@@ -859,7 +859,7 @@ function caml_ba_hash(ba) {
859859 w = ba . data [ i + 0 ] | ( ba . data [ i + 1 ] << 16 ) ;
860860 h = caml_hash_mix_int ( h , w ) ;
861861 }
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 ] ) ;
863863 break ;
864864 case 6 : // Int32Array (int32)
865865 if ( num_elts > 64 ) num_elts = 64 ;
0 commit comments