Skip to content

Commit 68107ea

Browse files
committed
more examples
1 parent 32c309b commit 68107ea

File tree

8 files changed

+29
-34
lines changed

8 files changed

+29
-34
lines changed

jscomp/js.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ FILE=bin/reason.byte
88
ocamlbuild -lflags -no-check-prims -use-ocamlfind -I bin -no-hygiene -pkgs compiler-libs.common -no-links $FILE
99

1010
# jsoo_mkcmis stdlib
11-
js_of_ocaml -I +compiler-libs --toplevel +weak.js +toplevel.js ./polyfill.js _build/$FILE -I ./runtime/ --file js.cmi:/cmis/js.cmi --file js_unsafe.cmi:/cmis/js_unsafe.cmi --file js_re.cmi:/cmis/js_re.cmi -o _build/exports.js
11+
js_of_ocaml -I +compiler-libs --toplevel +weak.js +toplevel.js ./polyfill.js _build/$FILE -I ./others/ -I ./runtime/ --file js.cmi:/cmis/js.cmi --file js_unsafe.cmi:/cmis/js_unsafe.cmi --file js_re.cmi:/cmis/js_re.cmi -o _build/exports.js
1212

1313
DOCS_DIR=../docs/js-demo
1414

jscomp/others/.depend

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ bs_node_module.cmj : bs_node.cmj bs_dict.cmj
1010
bs_node_module.cmx : bs_node.cmx bs_dict.cmx
1111
js_array.cmj :
1212
js_array.cmx :
13-
js_string.cmj : bs.cmj js_string.cmi
14-
js_string.cmx : bs.cmx js_string.cmi
13+
js_string.cmj : bs.cmj
14+
js_string.cmx : bs.cmx
1515
js_re.cmj : js_re.cmi
1616
js_re.cmx : js_re.cmi
17-
js_string.cmi :
1817
js_re.cmi :
1918
bs_node_path.cmo :
2019
bs_node_path.cmj :
@@ -28,7 +27,7 @@ bs_node_module.cmo : bs_node.cmo bs_dict.cmo
2827
bs_node_module.cmj : bs_node.cmj bs_dict.cmj
2928
js_array.cmo :
3029
js_array.cmj :
31-
js_string.cmo : bs.cmo js_string.cmi
32-
js_string.cmj : bs.cmj js_string.cmi
30+
js_string.cmo : bs.cmo
31+
js_string.cmj : bs.cmj
3332
js_re.cmo : js_re.cmi
3433
js_re.cmj : js_re.cmi

jscomp/others/js_string.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ external charAt : int -> t = "" [@@bs.send.pipe: t]
5151

5252
external charCodeAt : int -> float = "" [@@bs.send.pipe: t]
5353
(** type it as [float] due to that it may return NAN *)
54-
external concat : t -> t = "" [@@bs.send.pipe: t]
54+
external concat : t -> t = "" [@@bs.send.pipe: t]
5555

5656
external indexOf : t -> int = "" [@@bs.send.pipe: t]
5757
external indexOf_from : t -> int -> int = "indexOf" [@@bs.send.pipe: t]
@@ -70,8 +70,9 @@ external slice_end : int -> t = "slice" [@@bs.send.pipe: t]
7070

7171
external split : t -> t array = "" [@@bs.send.pipe: t]
7272
external split_limited : t -> int -> t array = "split" [@@bs.send.pipe: t]
73-
external split_regExp : Bs.Re.t -> t array = "split" [@@bs.send.pipe: t]
73+
external split_by_reg : Bs.Re.t -> t array = "split" [@@bs.send.pipe: t]
7474
external split_regExpLimited : Bs.Re.t -> int -> t array = "" [@@bs.send.pipe: t]
75+
7576
external substring : int -> int -> t = "" [@@bs.send.pipe: t]
7677
external substring_toEnd : int -> t = "substring" [@@bs.send.pipe: t]
7778
external toLowerCase : t = "" [@@bs.send.pipe: t]

jscomp/others/js_string.mli

Lines changed: 0 additions & 25 deletions
This file was deleted.

jscomp/test/.depend

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ bs_array_test.cmj : ../runtime/js.cmj ../others/bs.cmj
8787
bs_array_test.cmx : ../runtime/js.cmx ../others/bs.cmx
8888
bs_rest_test.cmj :
8989
bs_rest_test.cmx :
90+
bs_string_test.cmj : ../runtime/js.cmj ../others/bs.cmj
91+
bs_string_test.cmx : ../runtime/js.cmx ../others/bs.cmx
9092
buffer_test.cmj : ../stdlib/string.cmi mt.cmi ../stdlib/bytes.cmi \
9193
../stdlib/buffer.cmi
9294
buffer_test.cmx : ../stdlib/string.cmx mt.cmx ../stdlib/bytes.cmx \
@@ -869,6 +871,8 @@ bs_array_test.cmo : ../runtime/js.cmo ../others/bs.cmo
869871
bs_array_test.cmj : ../runtime/js.cmj ../others/bs.cmj
870872
bs_rest_test.cmo :
871873
bs_rest_test.cmj :
874+
bs_string_test.cmo : ../runtime/js.cmo ../others/bs.cmo
875+
bs_string_test.cmj : ../runtime/js.cmj ../others/bs.cmj
872876
buffer_test.cmo : ../stdlib/string.cmi mt.cmi ../stdlib/bytes.cmi \
873877
../stdlib/buffer.cmi
874878
buffer_test.cmj : ../stdlib/string.cmj mt.cmj ../stdlib/bytes.cmj \

jscomp/test/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ OTHERS := literals a test_ari test_export2 test_internalOO test_obj_simple_ffi t
6161
test_case_set test_mutliple string_bound_get_test inline_string_test\
6262
ppx_this_obj_test unsafe_obj_external gpr_627_test jsoo_485_test jsoo_400_test \
6363
test_require more_uncurry earger_curry_test poly_type bench mutable_obj_test\
64-
gpr_658 module_as_class_ffi pipe_send_readline demo_pipe bs_array_test
64+
gpr_658 module_as_class_ffi pipe_send_readline demo_pipe bs_array_test bs_string_test
6565

6666

6767

jscomp/test/bs_string_test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict';
2+
3+
4+
console.log("ghso ghso g".split(" ").reduce(function (x, y) {
5+
return x + ("-" + y);
6+
}, ""));
7+
8+
/* Not a pure module */

jscomp/test/bs_string_test.ml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
3+
let () =
4+
"ghso ghso g"
5+
|> Bs.String.split " "
6+
|> Bs.Array.reduce (fun [@bs] x y -> x ^ "-" ^ y) ""
7+
|> Js.log
8+

0 commit comments

Comments
 (0)