Skip to content

Commit 9fea72f

Browse files
committed
WIP
1 parent b45d4d2 commit 9fea72f

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

runtime/mlBytes.js

+17-15
Original file line numberDiff line numberDiff line change
@@ -321,14 +321,14 @@ function caml_bytes_set(s, i, c) {
321321
}
322322

323323
//Provides: jsoo_text_encoder
324-
var jsoo_text_encoder = new TextEncoder ();
324+
var jsoo_text_encoder = new TextEncoder();
325325

326326
//Provides: jsoo_text_decoder
327-
var jsoo_text_decoder = new TextDecoder ();
327+
var jsoo_text_decoder = new TextDecoder();
328328

329329
//Provides: caml_bytes_of_utf16_jsstring
330330
//Requires: MlBytes, jsoo_text_encoder
331-
function caml_bytes_of_utf16_jsstring (s) {
331+
function caml_bytes_of_utf16_jsstring(s) {
332332
var a = jsoo_text_encoder.encode(s);
333333
return new MlBytes(4, a, a.length);
334334
}
@@ -337,8 +337,10 @@ function caml_bytes_of_utf16_jsstring (s) {
337337
//Requires: caml_convert_string_to_bytes, jsoo_is_ascii
338338
//Requires: caml_uint8_array_of_bytes
339339
//Requires: jsoo_text_decoder
340-
function MlBytes (tag, contents, length) {
341-
this.t=tag; this.c=contents; this.l=length;
340+
function MlBytes(tag, contents, length) {
341+
this.t = tag;
342+
this.c = contents;
343+
this.l = length;
342344
}
343345
MlBytes.prototype.toString = function () {
344346
switch (this.t) {
@@ -356,12 +358,12 @@ MlBytes.prototype.toString = function () {
356358
return this.c;
357359
}
358360
};
359-
MlBytes.prototype.toUtf16 = function (){
360-
if(this.t == 9) return this.c;
361+
MlBytes.prototype.toUtf16 = function () {
362+
if (this.t == 9) return this.c;
361363
var a = caml_uint8_array_of_bytes(this);
362364
return jsoo_text_decoder.decode(a);
363-
}
364-
MlBytes.prototype.slice = function (){
365+
};
366+
MlBytes.prototype.slice = function () {
365367
var content = this.t == 4 ? this.c.slice() : this.c;
366368
return new MlBytes(this.t, content, this.l);
367369
};
@@ -682,12 +684,12 @@ var jsoo_text_decoder_buff = new ArrayBuffer(1024);
682684
//Requires: jsoo_text_decoder_buff
683685
//If: js-string
684686
function caml_jsstring_of_string(s) {
685-
if(jsoo_is_ascii(s)) return s;
687+
if (jsoo_is_ascii(s)) return s;
686688
var a =
687-
(s.length <= jsoo_text_decoder_buff.length)
688-
? Uint8Array(jsoo_text_decoder_buff, 0, s.length)
689-
: (new Uint8Array(s.length));
690-
for(var i = 0; i < s.length; i++){
689+
s.length <= jsoo_text_decoder_buff.length
690+
? new Uint8Array(jsoo_text_decoder_buff, 0, s.length)
691+
: new Uint8Array(s.length);
692+
for (var i = 0; i < s.length; i++) {
691693
a[i] = s.charCodeAt(i);
692694
}
693695
return jsoo_text_decoder.decode(a);
@@ -697,7 +699,7 @@ function caml_jsstring_of_string(s) {
697699
//Requires: caml_string_of_array
698700
//Requires: jsoo_text_encoder
699701
//If: js-string
700-
function caml_string_of_jsstring (s) {
702+
function caml_string_of_jsstring(s) {
701703
var a = jsoo_text_encoder.encode(s);
702704
return caml_string_of_array(a);
703705
}

0 commit comments

Comments
 (0)