We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 31317ca commit 1585b70Copy full SHA for 1585b70
runtime/js/mlBytes.js
@@ -742,10 +742,18 @@ function caml_string_lessthan(s1, s2) {
742
743
//Provides: caml_string_of_bytes
744
//Requires: caml_convert_string_to_bytes, caml_string_of_jsbytes
745
+//Requires: caml_subarray_to_jsbytes
746
//If: js-string
747
function caml_string_of_bytes(s) {
- s.t & 6 && caml_convert_string_to_bytes(s);
748
- return caml_string_of_jsbytes(s.c);
+ switch (s.t & 6) {
749
+ case 0 /* BYTES */:
750
+ return caml_string_of_jsbytes(s.c);
751
+ case 2 /* PARTIAL */:
752
+ caml_convert_string_to_bytes(s);
753
754
+ case 4 /* ARRAY */:
755
+ return caml_subarray_to_jsbytes(s.c, 0, s.c.length);
756
+ }
757
}
758
759
//Provides: caml_bytes_of_string const
0 commit comments