@tellahq/rescript 10.1.0-alpha.2 → 10.1.4-republish-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (668) hide show
  1. package/CHANGELOG.md +204 -2
  2. package/README.md +1 -1
  3. package/darwinarm64/bsb_helper.exe +0 -0
  4. package/darwinarm64/bsc.exe +0 -0
  5. package/darwinarm64/ninja.exe +0 -0
  6. package/darwinarm64/rescript.exe +0 -0
  7. package/docs/docson/build-schema.json +497 -516
  8. package/lib/4.06.1/bsb_helper.ml +6 -1
  9. package/lib/4.06.1/rescript.ml +1414 -1191
  10. package/lib/4.06.1/whole_compiler.ml +69844 -69069
  11. package/lib/es6/belt_internalBuckets.js +13 -13
  12. package/lib/es6/caml_float.js +5 -5
  13. package/lib/es6/caml_format.js +1 -1
  14. package/lib/es6/caml_int64.js +1 -1
  15. package/lib/es6/caml_obj.js +26 -6
  16. package/lib/es6/complex.js +4 -4
  17. package/lib/es6/js.js +3 -0
  18. package/lib/es6/js_promise2.js +16 -0
  19. package/lib/es6/jsxPPXReactSupport.js +26 -0
  20. package/lib/js/belt_internalBuckets.js +13 -13
  21. package/lib/js/caml_float.js +5 -5
  22. package/lib/js/caml_format.js +1 -1
  23. package/lib/js/caml_int64.js +1 -1
  24. package/lib/js/caml_obj.js +26 -6
  25. package/lib/js/complex.js +4 -4
  26. package/lib/js/js.js +3 -0
  27. package/lib/js/js_promise2.js +14 -0
  28. package/lib/js/jsxPPXReactSupport.js +24 -0
  29. package/package.json +2 -1
  30. package/scripts/buildNinjaBinary.js +29 -0
  31. package/scripts/install.js +7 -3
  32. package/scripts/installUtils.js +9 -1
  33. package/scripts/rescript_arg.js +2 -4
  34. package/scripts/rescript_format.js +73 -39
  35. package/win32/refmt.exe +0 -0
  36. package/darwin/bsb_helper.exe +0 -0
  37. package/darwin/bsc.exe +0 -0
  38. package/darwin/ninja.COPYING +0 -202
  39. package/darwin/ninja.exe +0 -0
  40. package/darwin/rescript.exe +0 -0
  41. package/darwinarm64/ninja.COPYING +0 -202
  42. package/freebsd/ninja.COPYING +0 -202
  43. package/lib/ocaml/arg.cmi +0 -0
  44. package/lib/ocaml/arg.cmt +0 -0
  45. package/lib/ocaml/arg.cmti +0 -0
  46. package/lib/ocaml/arg.ml +0 -359
  47. package/lib/ocaml/arg.mli +0 -185
  48. package/lib/ocaml/array.cmi +0 -0
  49. package/lib/ocaml/array.cmt +0 -0
  50. package/lib/ocaml/array.cmti +0 -0
  51. package/lib/ocaml/array.ml +0 -307
  52. package/lib/ocaml/array.mli +0 -275
  53. package/lib/ocaml/arrayLabels.cmi +0 -0
  54. package/lib/ocaml/arrayLabels.cmt +0 -0
  55. package/lib/ocaml/arrayLabels.cmti +0 -0
  56. package/lib/ocaml/arrayLabels.ml +0 -307
  57. package/lib/ocaml/arrayLabels.mli +0 -276
  58. package/lib/ocaml/belt.cmi +0 -0
  59. package/lib/ocaml/belt.cmt +0 -0
  60. package/lib/ocaml/belt.ml +0 -352
  61. package/lib/ocaml/belt_Array.cmi +0 -0
  62. package/lib/ocaml/belt_Array.cmt +0 -0
  63. package/lib/ocaml/belt_Array.cmti +0 -0
  64. package/lib/ocaml/belt_Array.ml +0 -525
  65. package/lib/ocaml/belt_Array.mli +0 -707
  66. package/lib/ocaml/belt_Float.cmi +0 -0
  67. package/lib/ocaml/belt_Float.cmt +0 -0
  68. package/lib/ocaml/belt_Float.cmti +0 -0
  69. package/lib/ocaml/belt_Float.ml +0 -50
  70. package/lib/ocaml/belt_Float.mli +0 -106
  71. package/lib/ocaml/belt_HashMap.cmi +0 -0
  72. package/lib/ocaml/belt_HashMap.cmt +0 -0
  73. package/lib/ocaml/belt_HashMap.cmti +0 -0
  74. package/lib/ocaml/belt_HashMap.ml +0 -226
  75. package/lib/ocaml/belt_HashMap.mli +0 -436
  76. package/lib/ocaml/belt_HashMapInt.cmi +0 -0
  77. package/lib/ocaml/belt_HashMapInt.cmt +0 -0
  78. package/lib/ocaml/belt_HashMapInt.cmti +0 -0
  79. package/lib/ocaml/belt_HashMapInt.ml +0 -206
  80. package/lib/ocaml/belt_HashMapInt.mli +0 -50
  81. package/lib/ocaml/belt_HashMapString.cmi +0 -0
  82. package/lib/ocaml/belt_HashMapString.cmt +0 -0
  83. package/lib/ocaml/belt_HashMapString.cmti +0 -0
  84. package/lib/ocaml/belt_HashMapString.ml +0 -206
  85. package/lib/ocaml/belt_HashMapString.mli +0 -50
  86. package/lib/ocaml/belt_HashSet.cmi +0 -0
  87. package/lib/ocaml/belt_HashSet.cmt +0 -0
  88. package/lib/ocaml/belt_HashSet.cmti +0 -0
  89. package/lib/ocaml/belt_HashSet.ml +0 -196
  90. package/lib/ocaml/belt_HashSet.mli +0 -125
  91. package/lib/ocaml/belt_HashSetInt.cmi +0 -0
  92. package/lib/ocaml/belt_HashSetInt.cmt +0 -0
  93. package/lib/ocaml/belt_HashSetInt.cmti +0 -0
  94. package/lib/ocaml/belt_HashSetInt.ml +0 -155
  95. package/lib/ocaml/belt_HashSetInt.mli +0 -74
  96. package/lib/ocaml/belt_HashSetString.cmi +0 -0
  97. package/lib/ocaml/belt_HashSetString.cmt +0 -0
  98. package/lib/ocaml/belt_HashSetString.cmti +0 -0
  99. package/lib/ocaml/belt_HashSetString.ml +0 -156
  100. package/lib/ocaml/belt_HashSetString.mli +0 -74
  101. package/lib/ocaml/belt_Id.cmi +0 -0
  102. package/lib/ocaml/belt_Id.cmt +0 -0
  103. package/lib/ocaml/belt_Id.cmti +0 -0
  104. package/lib/ocaml/belt_Id.ml +0 -133
  105. package/lib/ocaml/belt_Id.mli +0 -171
  106. package/lib/ocaml/belt_Int.cmi +0 -0
  107. package/lib/ocaml/belt_Int.cmt +0 -0
  108. package/lib/ocaml/belt_Int.cmti +0 -0
  109. package/lib/ocaml/belt_Int.ml +0 -50
  110. package/lib/ocaml/belt_Int.mli +0 -103
  111. package/lib/ocaml/belt_List.cmi +0 -0
  112. package/lib/ocaml/belt_List.cmt +0 -0
  113. package/lib/ocaml/belt_List.cmti +0 -0
  114. package/lib/ocaml/belt_List.ml +0 -803
  115. package/lib/ocaml/belt_List.mli +0 -844
  116. package/lib/ocaml/belt_Map.cmi +0 -0
  117. package/lib/ocaml/belt_Map.cmt +0 -0
  118. package/lib/ocaml/belt_Map.cmti +0 -0
  119. package/lib/ocaml/belt_Map.ml +0 -170
  120. package/lib/ocaml/belt_Map.mli +0 -496
  121. package/lib/ocaml/belt_MapDict.cmi +0 -0
  122. package/lib/ocaml/belt_MapDict.cmt +0 -0
  123. package/lib/ocaml/belt_MapDict.cmti +0 -0
  124. package/lib/ocaml/belt_MapDict.ml +0 -278
  125. package/lib/ocaml/belt_MapDict.mli +0 -268
  126. package/lib/ocaml/belt_MapInt.cmi +0 -0
  127. package/lib/ocaml/belt_MapInt.cmt +0 -0
  128. package/lib/ocaml/belt_MapInt.cmti +0 -0
  129. package/lib/ocaml/belt_MapInt.ml +0 -169
  130. package/lib/ocaml/belt_MapInt.mli +0 -187
  131. package/lib/ocaml/belt_MapString.cmi +0 -0
  132. package/lib/ocaml/belt_MapString.cmt +0 -0
  133. package/lib/ocaml/belt_MapString.cmti +0 -0
  134. package/lib/ocaml/belt_MapString.ml +0 -169
  135. package/lib/ocaml/belt_MapString.mli +0 -187
  136. package/lib/ocaml/belt_MutableMap.cmi +0 -0
  137. package/lib/ocaml/belt_MutableMap.cmt +0 -0
  138. package/lib/ocaml/belt_MutableMap.cmti +0 -0
  139. package/lib/ocaml/belt_MutableMap.ml +0 -241
  140. package/lib/ocaml/belt_MutableMap.mli +0 -145
  141. package/lib/ocaml/belt_MutableMapInt.cmi +0 -0
  142. package/lib/ocaml/belt_MutableMapInt.cmt +0 -0
  143. package/lib/ocaml/belt_MutableMapInt.cmti +0 -0
  144. package/lib/ocaml/belt_MutableMapInt.ml +0 -172
  145. package/lib/ocaml/belt_MutableMapInt.mli +0 -135
  146. package/lib/ocaml/belt_MutableMapString.cmi +0 -0
  147. package/lib/ocaml/belt_MutableMapString.cmt +0 -0
  148. package/lib/ocaml/belt_MutableMapString.cmti +0 -0
  149. package/lib/ocaml/belt_MutableMapString.ml +0 -172
  150. package/lib/ocaml/belt_MutableMapString.mli +0 -135
  151. package/lib/ocaml/belt_MutableQueue.cmi +0 -0
  152. package/lib/ocaml/belt_MutableQueue.cmt +0 -0
  153. package/lib/ocaml/belt_MutableQueue.cmti +0 -0
  154. package/lib/ocaml/belt_MutableQueue.ml +0 -222
  155. package/lib/ocaml/belt_MutableQueue.mli +0 -116
  156. package/lib/ocaml/belt_MutableSet.cmi +0 -0
  157. package/lib/ocaml/belt_MutableSet.cmt +0 -0
  158. package/lib/ocaml/belt_MutableSet.cmti +0 -0
  159. package/lib/ocaml/belt_MutableSet.ml +0 -371
  160. package/lib/ocaml/belt_MutableSet.mli +0 -617
  161. package/lib/ocaml/belt_MutableSetInt.cmi +0 -0
  162. package/lib/ocaml/belt_MutableSetInt.cmt +0 -0
  163. package/lib/ocaml/belt_MutableSetInt.cmti +0 -0
  164. package/lib/ocaml/belt_MutableSetInt.ml +0 -342
  165. package/lib/ocaml/belt_MutableSetInt.mli +0 -124
  166. package/lib/ocaml/belt_MutableSetString.cmi +0 -0
  167. package/lib/ocaml/belt_MutableSetString.cmt +0 -0
  168. package/lib/ocaml/belt_MutableSetString.cmti +0 -0
  169. package/lib/ocaml/belt_MutableSetString.ml +0 -342
  170. package/lib/ocaml/belt_MutableSetString.mli +0 -124
  171. package/lib/ocaml/belt_MutableStack.cmi +0 -0
  172. package/lib/ocaml/belt_MutableStack.cmt +0 -0
  173. package/lib/ocaml/belt_MutableStack.cmti +0 -0
  174. package/lib/ocaml/belt_MutableStack.ml +0 -106
  175. package/lib/ocaml/belt_MutableStack.mli +0 -63
  176. package/lib/ocaml/belt_Option.cmi +0 -0
  177. package/lib/ocaml/belt_Option.cmt +0 -0
  178. package/lib/ocaml/belt_Option.cmti +0 -0
  179. package/lib/ocaml/belt_Option.ml +0 -93
  180. package/lib/ocaml/belt_Option.mli +0 -270
  181. package/lib/ocaml/belt_Range.cmi +0 -0
  182. package/lib/ocaml/belt_Range.cmt +0 -0
  183. package/lib/ocaml/belt_Range.cmti +0 -0
  184. package/lib/ocaml/belt_Range.ml +0 -76
  185. package/lib/ocaml/belt_Range.mli +0 -114
  186. package/lib/ocaml/belt_Result.cmi +0 -0
  187. package/lib/ocaml/belt_Result.cmt +0 -0
  188. package/lib/ocaml/belt_Result.cmti +0 -0
  189. package/lib/ocaml/belt_Result.ml +0 -75
  190. package/lib/ocaml/belt_Result.mli +0 -205
  191. package/lib/ocaml/belt_Set.cmi +0 -0
  192. package/lib/ocaml/belt_Set.cmt +0 -0
  193. package/lib/ocaml/belt_Set.cmti +0 -0
  194. package/lib/ocaml/belt_Set.cppo.ml +0 -205
  195. package/lib/ocaml/belt_Set.cppo.mli +0 -153
  196. package/lib/ocaml/belt_Set.ml +0 -164
  197. package/lib/ocaml/belt_Set.mli +0 -523
  198. package/lib/ocaml/belt_SetDict.cmi +0 -0
  199. package/lib/ocaml/belt_SetDict.cmt +0 -0
  200. package/lib/ocaml/belt_SetDict.cmti +0 -0
  201. package/lib/ocaml/belt_SetDict.ml +0 -237
  202. package/lib/ocaml/belt_SetDict.mli +0 -567
  203. package/lib/ocaml/belt_SetInt.cmi +0 -0
  204. package/lib/ocaml/belt_SetInt.cmt +0 -0
  205. package/lib/ocaml/belt_SetInt.cmti +0 -0
  206. package/lib/ocaml/belt_SetInt.ml +0 -201
  207. package/lib/ocaml/belt_SetInt.mli +0 -151
  208. package/lib/ocaml/belt_SetString.cmi +0 -0
  209. package/lib/ocaml/belt_SetString.cmt +0 -0
  210. package/lib/ocaml/belt_SetString.cmti +0 -0
  211. package/lib/ocaml/belt_SetString.ml +0 -201
  212. package/lib/ocaml/belt_SetString.mli +0 -151
  213. package/lib/ocaml/belt_SortArray.cmi +0 -0
  214. package/lib/ocaml/belt_SortArray.cmt +0 -0
  215. package/lib/ocaml/belt_SortArray.cmti +0 -0
  216. package/lib/ocaml/belt_SortArray.ml +0 -322
  217. package/lib/ocaml/belt_SortArray.mli +0 -146
  218. package/lib/ocaml/belt_SortArrayInt.cmi +0 -0
  219. package/lib/ocaml/belt_SortArrayInt.cmt +0 -0
  220. package/lib/ocaml/belt_SortArrayInt.cmti +0 -0
  221. package/lib/ocaml/belt_SortArrayInt.ml +0 -263
  222. package/lib/ocaml/belt_SortArrayInt.mli +0 -93
  223. package/lib/ocaml/belt_SortArrayString.cmi +0 -0
  224. package/lib/ocaml/belt_SortArrayString.cmt +0 -0
  225. package/lib/ocaml/belt_SortArrayString.cmti +0 -0
  226. package/lib/ocaml/belt_SortArrayString.ml +0 -263
  227. package/lib/ocaml/belt_SortArrayString.mli +0 -93
  228. package/lib/ocaml/belt_internalAVLset.cmt +0 -0
  229. package/lib/ocaml/belt_internalAVLset.cmti +0 -0
  230. package/lib/ocaml/belt_internalAVLset.ml +0 -665
  231. package/lib/ocaml/belt_internalAVLset.mli +0 -124
  232. package/lib/ocaml/belt_internalAVLtree.cmt +0 -0
  233. package/lib/ocaml/belt_internalAVLtree.cmti +0 -0
  234. package/lib/ocaml/belt_internalAVLtree.ml +0 -762
  235. package/lib/ocaml/belt_internalAVLtree.mli +0 -215
  236. package/lib/ocaml/belt_internalBuckets.cmt +0 -0
  237. package/lib/ocaml/belt_internalBuckets.cmti +0 -0
  238. package/lib/ocaml/belt_internalBuckets.ml +0 -218
  239. package/lib/ocaml/belt_internalBuckets.mli +0 -57
  240. package/lib/ocaml/belt_internalBucketsType.cmt +0 -0
  241. package/lib/ocaml/belt_internalBucketsType.cmti +0 -0
  242. package/lib/ocaml/belt_internalBucketsType.ml +0 -59
  243. package/lib/ocaml/belt_internalBucketsType.mli +0 -46
  244. package/lib/ocaml/belt_internalMapInt.cmt +0 -0
  245. package/lib/ocaml/belt_internalMapInt.ml +0 -227
  246. package/lib/ocaml/belt_internalMapString.cmt +0 -0
  247. package/lib/ocaml/belt_internalMapString.ml +0 -227
  248. package/lib/ocaml/belt_internalSetBuckets.cmt +0 -0
  249. package/lib/ocaml/belt_internalSetBuckets.cmti +0 -0
  250. package/lib/ocaml/belt_internalSetBuckets.ml +0 -157
  251. package/lib/ocaml/belt_internalSetBuckets.mli +0 -47
  252. package/lib/ocaml/belt_internalSetInt.cmt +0 -0
  253. package/lib/ocaml/belt_internalSetInt.ml +0 -129
  254. package/lib/ocaml/belt_internalSetString.cmt +0 -0
  255. package/lib/ocaml/belt_internalSetString.ml +0 -129
  256. package/lib/ocaml/belt_internals.cmti +0 -0
  257. package/lib/ocaml/belt_internals.mli +0 -79
  258. package/lib/ocaml/buffer.cmi +0 -0
  259. package/lib/ocaml/buffer.cmt +0 -0
  260. package/lib/ocaml/buffer.cmti +0 -0
  261. package/lib/ocaml/buffer.ml +0 -250
  262. package/lib/ocaml/buffer.mli +0 -149
  263. package/lib/ocaml/bytes.cmi +0 -0
  264. package/lib/ocaml/bytes.cmt +0 -0
  265. package/lib/ocaml/bytes.cmti +0 -0
  266. package/lib/ocaml/bytes.ml +0 -431
  267. package/lib/ocaml/bytes.mli +0 -430
  268. package/lib/ocaml/bytesLabels.cmi +0 -0
  269. package/lib/ocaml/bytesLabels.cmt +0 -0
  270. package/lib/ocaml/bytesLabels.cmti +0 -0
  271. package/lib/ocaml/bytesLabels.ml +0 -428
  272. package/lib/ocaml/bytesLabels.mli +0 -276
  273. package/lib/ocaml/callback.cmi +0 -0
  274. package/lib/ocaml/callback.cmt +0 -0
  275. package/lib/ocaml/callback.cmti +0 -0
  276. package/lib/ocaml/callback.ml +0 -20
  277. package/lib/ocaml/callback.mli +0 -34
  278. package/lib/ocaml/camlinternalLazy.cmi +0 -0
  279. package/lib/ocaml/camlinternalLazy.cmt +0 -0
  280. package/lib/ocaml/camlinternalLazy.cmti +0 -0
  281. package/lib/ocaml/camlinternalLazy.ml +0 -89
  282. package/lib/ocaml/camlinternalLazy.mli +0 -27
  283. package/lib/ocaml/camlinternalMod.cmi +0 -0
  284. package/lib/ocaml/camlinternalMod.cmt +0 -0
  285. package/lib/ocaml/camlinternalMod.cmti +0 -0
  286. package/lib/ocaml/camlinternalMod.ml +0 -21
  287. package/lib/ocaml/camlinternalMod.mli +0 -25
  288. package/lib/ocaml/char.cmi +0 -0
  289. package/lib/ocaml/char.cmt +0 -0
  290. package/lib/ocaml/char.cmti +0 -0
  291. package/lib/ocaml/char.ml +0 -76
  292. package/lib/ocaml/char.mli +0 -72
  293. package/lib/ocaml/complex.cmi +0 -0
  294. package/lib/ocaml/complex.cmt +0 -0
  295. package/lib/ocaml/complex.cmti +0 -0
  296. package/lib/ocaml/complex.ml +0 -87
  297. package/lib/ocaml/complex.mli +0 -86
  298. package/lib/ocaml/digest.cmi +0 -0
  299. package/lib/ocaml/digest.cmt +0 -0
  300. package/lib/ocaml/digest.cmti +0 -0
  301. package/lib/ocaml/digest.ml +0 -66
  302. package/lib/ocaml/digest.mli +0 -68
  303. package/lib/ocaml/dom.cmi +0 -0
  304. package/lib/ocaml/dom.cmt +0 -0
  305. package/lib/ocaml/dom.ml +0 -296
  306. package/lib/ocaml/dom_storage.cmi +0 -0
  307. package/lib/ocaml/dom_storage.cmt +0 -0
  308. package/lib/ocaml/dom_storage.ml +0 -22
  309. package/lib/ocaml/dom_storage2.cmi +0 -0
  310. package/lib/ocaml/dom_storage2.cmt +0 -0
  311. package/lib/ocaml/dom_storage2.ml +0 -11
  312. package/lib/ocaml/filename.cmi +0 -0
  313. package/lib/ocaml/filename.cmt +0 -0
  314. package/lib/ocaml/filename.cmti +0 -0
  315. package/lib/ocaml/filename.ml +0 -233
  316. package/lib/ocaml/filename.mli +0 -134
  317. package/lib/ocaml/genlex.cmi +0 -0
  318. package/lib/ocaml/genlex.cmt +0 -0
  319. package/lib/ocaml/genlex.cmti +0 -0
  320. package/lib/ocaml/genlex.ml +0 -201
  321. package/lib/ocaml/genlex.mli +0 -73
  322. package/lib/ocaml/hashmap.cppo.ml +0 -214
  323. package/lib/ocaml/hashmap.cppo.mli +0 -54
  324. package/lib/ocaml/hashset.cppo.ml +0 -165
  325. package/lib/ocaml/hashset.cppo.mli +0 -77
  326. package/lib/ocaml/hashtbl.cmi +0 -0
  327. package/lib/ocaml/hashtbl.cmt +0 -0
  328. package/lib/ocaml/hashtbl.cmti +0 -0
  329. package/lib/ocaml/hashtbl.ml +0 -541
  330. package/lib/ocaml/hashtbl.mli +0 -411
  331. package/lib/ocaml/hashtblLabels.cmi +0 -0
  332. package/lib/ocaml/hashtblLabels.cmt +0 -0
  333. package/lib/ocaml/hashtblLabels.ml +0 -130
  334. package/lib/ocaml/int32.cmi +0 -0
  335. package/lib/ocaml/int32.cmt +0 -0
  336. package/lib/ocaml/int32.cmti +0 -0
  337. package/lib/ocaml/int32.ml +0 -64
  338. package/lib/ocaml/int32.mli +0 -186
  339. package/lib/ocaml/int64.cmi +0 -0
  340. package/lib/ocaml/int64.cmt +0 -0
  341. package/lib/ocaml/int64.cmti +0 -0
  342. package/lib/ocaml/int64.ml +0 -72
  343. package/lib/ocaml/int64.mli +0 -197
  344. package/lib/ocaml/internal_map.cppo.ml +0 -230
  345. package/lib/ocaml/internal_set.cppo.ml +0 -134
  346. package/lib/ocaml/js.cmi +0 -0
  347. package/lib/ocaml/js.cmt +0 -0
  348. package/lib/ocaml/js.ml +0 -313
  349. package/lib/ocaml/js_OO.cmi +0 -0
  350. package/lib/ocaml/js_OO.cmt +0 -0
  351. package/lib/ocaml/js_OO.ml +0 -180
  352. package/lib/ocaml/js_array.cmi +0 -0
  353. package/lib/ocaml/js_array.cmt +0 -0
  354. package/lib/ocaml/js_array.ml +0 -970
  355. package/lib/ocaml/js_array2.cmi +0 -0
  356. package/lib/ocaml/js_array2.cmt +0 -0
  357. package/lib/ocaml/js_array2.ml +0 -1065
  358. package/lib/ocaml/js_bigint.cmi +0 -0
  359. package/lib/ocaml/js_bigint.cmt +0 -0
  360. package/lib/ocaml/js_bigint.ml +0 -3
  361. package/lib/ocaml/js_cast.cmi +0 -0
  362. package/lib/ocaml/js_cast.cmt +0 -0
  363. package/lib/ocaml/js_cast.cmti +0 -0
  364. package/lib/ocaml/js_cast.ml +0 -29
  365. package/lib/ocaml/js_cast.mli +0 -45
  366. package/lib/ocaml/js_console.cmi +0 -0
  367. package/lib/ocaml/js_console.cmt +0 -0
  368. package/lib/ocaml/js_console.ml +0 -51
  369. package/lib/ocaml/js_date.cmi +0 -0
  370. package/lib/ocaml/js_date.cmt +0 -0
  371. package/lib/ocaml/js_date.ml +0 -1263
  372. package/lib/ocaml/js_dict.cmi +0 -0
  373. package/lib/ocaml/js_dict.cmt +0 -0
  374. package/lib/ocaml/js_dict.cmti +0 -0
  375. package/lib/ocaml/js_dict.ml +0 -114
  376. package/lib/ocaml/js_dict.mli +0 -152
  377. package/lib/ocaml/js_exn.cmi +0 -0
  378. package/lib/ocaml/js_exn.cmt +0 -0
  379. package/lib/ocaml/js_exn.cmti +0 -0
  380. package/lib/ocaml/js_exn.ml +0 -102
  381. package/lib/ocaml/js_exn.mli +0 -79
  382. package/lib/ocaml/js_float.cmi +0 -0
  383. package/lib/ocaml/js_float.cmt +0 -0
  384. package/lib/ocaml/js_float.ml +0 -294
  385. package/lib/ocaml/js_global.cmi +0 -0
  386. package/lib/ocaml/js_global.cmt +0 -0
  387. package/lib/ocaml/js_global.ml +0 -185
  388. package/lib/ocaml/js_int.cmi +0 -0
  389. package/lib/ocaml/js_int.cmt +0 -0
  390. package/lib/ocaml/js_int.ml +0 -158
  391. package/lib/ocaml/js_json.cmi +0 -0
  392. package/lib/ocaml/js_json.cmt +0 -0
  393. package/lib/ocaml/js_json.cmti +0 -0
  394. package/lib/ocaml/js_json.ml +0 -195
  395. package/lib/ocaml/js_json.mli +0 -244
  396. package/lib/ocaml/js_list.cmi +0 -0
  397. package/lib/ocaml/js_list.cmt +0 -0
  398. package/lib/ocaml/js_list.cmti +0 -0
  399. package/lib/ocaml/js_list.ml +0 -174
  400. package/lib/ocaml/js_list.mli +0 -72
  401. package/lib/ocaml/js_map.cmi +0 -0
  402. package/lib/ocaml/js_map.cmt +0 -0
  403. package/lib/ocaml/js_map.ml +0 -3
  404. package/lib/ocaml/js_mapperRt.cmi +0 -0
  405. package/lib/ocaml/js_mapperRt.cmt +0 -0
  406. package/lib/ocaml/js_mapperRt.cmti +0 -0
  407. package/lib/ocaml/js_mapperRt.ml +0 -50
  408. package/lib/ocaml/js_mapperRt.mli +0 -44
  409. package/lib/ocaml/js_math.cmi +0 -0
  410. package/lib/ocaml/js_math.cmt +0 -0
  411. package/lib/ocaml/js_math.ml +0 -626
  412. package/lib/ocaml/js_null.cmi +0 -0
  413. package/lib/ocaml/js_null.cmt +0 -0
  414. package/lib/ocaml/js_null.cmti +0 -0
  415. package/lib/ocaml/js_null.ml +0 -57
  416. package/lib/ocaml/js_null.mli +0 -87
  417. package/lib/ocaml/js_null_undefined.cmi +0 -0
  418. package/lib/ocaml/js_null_undefined.cmt +0 -0
  419. package/lib/ocaml/js_null_undefined.cmti +0 -0
  420. package/lib/ocaml/js_null_undefined.ml +0 -50
  421. package/lib/ocaml/js_null_undefined.mli +0 -85
  422. package/lib/ocaml/js_obj.cmi +0 -0
  423. package/lib/ocaml/js_obj.cmt +0 -0
  424. package/lib/ocaml/js_obj.ml +0 -100
  425. package/lib/ocaml/js_option.cmi +0 -0
  426. package/lib/ocaml/js_option.cmt +0 -0
  427. package/lib/ocaml/js_option.cmti +0 -0
  428. package/lib/ocaml/js_option.ml +0 -203
  429. package/lib/ocaml/js_option.mli +0 -52
  430. package/lib/ocaml/js_promise.cmi +0 -0
  431. package/lib/ocaml/js_promise.cmt +0 -0
  432. package/lib/ocaml/js_promise.ml +0 -100
  433. package/lib/ocaml/js_re.cmi +0 -0
  434. package/lib/ocaml/js_re.cmt +0 -0
  435. package/lib/ocaml/js_re.ml +0 -184
  436. package/lib/ocaml/js_result.cmi +0 -0
  437. package/lib/ocaml/js_result.cmt +0 -0
  438. package/lib/ocaml/js_result.cmti +0 -0
  439. package/lib/ocaml/js_result.ml +0 -28
  440. package/lib/ocaml/js_result.mli +0 -28
  441. package/lib/ocaml/js_set.cmi +0 -0
  442. package/lib/ocaml/js_set.cmt +0 -0
  443. package/lib/ocaml/js_set.ml +0 -3
  444. package/lib/ocaml/js_string.cmi +0 -0
  445. package/lib/ocaml/js_string.cmt +0 -0
  446. package/lib/ocaml/js_string.ml +0 -914
  447. package/lib/ocaml/js_string2.cmi +0 -0
  448. package/lib/ocaml/js_string2.cmt +0 -0
  449. package/lib/ocaml/js_string2.ml +0 -912
  450. package/lib/ocaml/js_typed_array.cmi +0 -0
  451. package/lib/ocaml/js_typed_array.cmt +0 -0
  452. package/lib/ocaml/js_typed_array.cppo.ml +0 -429
  453. package/lib/ocaml/js_typed_array.ml +0 -1405
  454. package/lib/ocaml/js_typed_array2.cmi +0 -0
  455. package/lib/ocaml/js_typed_array2.cmt +0 -0
  456. package/lib/ocaml/js_typed_array2.cppo.ml +0 -296
  457. package/lib/ocaml/js_typed_array2.ml +0 -1269
  458. package/lib/ocaml/js_types.cmi +0 -0
  459. package/lib/ocaml/js_types.cmt +0 -0
  460. package/lib/ocaml/js_types.cmti +0 -0
  461. package/lib/ocaml/js_types.ml +0 -118
  462. package/lib/ocaml/js_types.mli +0 -78
  463. package/lib/ocaml/js_undefined.cmi +0 -0
  464. package/lib/ocaml/js_undefined.cmt +0 -0
  465. package/lib/ocaml/js_undefined.cmti +0 -0
  466. package/lib/ocaml/js_undefined.ml +0 -59
  467. package/lib/ocaml/js_undefined.mli +0 -92
  468. package/lib/ocaml/js_vector.cmi +0 -0
  469. package/lib/ocaml/js_vector.cmt +0 -0
  470. package/lib/ocaml/js_vector.cmti +0 -0
  471. package/lib/ocaml/js_vector.ml +0 -143
  472. package/lib/ocaml/js_vector.mli +0 -92
  473. package/lib/ocaml/js_weakmap.cmi +0 -0
  474. package/lib/ocaml/js_weakmap.cmt +0 -0
  475. package/lib/ocaml/js_weakmap.ml +0 -3
  476. package/lib/ocaml/js_weakset.cmi +0 -0
  477. package/lib/ocaml/js_weakset.cmt +0 -0
  478. package/lib/ocaml/js_weakset.ml +0 -3
  479. package/lib/ocaml/jsx.cmi +0 -0
  480. package/lib/ocaml/jsx.cmt +0 -0
  481. package/lib/ocaml/jsx.ml +0 -39
  482. package/lib/ocaml/jsxDOM.cmi +0 -0
  483. package/lib/ocaml/jsxDOM.cmt +0 -0
  484. package/lib/ocaml/jsxDOM.ml +0 -2087
  485. package/lib/ocaml/jsxDOMStyle.cmi +0 -0
  486. package/lib/ocaml/jsxDOMStyle.cmt +0 -0
  487. package/lib/ocaml/jsxDOMStyle.ml +0 -777
  488. package/lib/ocaml/jsxEvent.cmi +0 -0
  489. package/lib/ocaml/jsxEvent.cmt +0 -0
  490. package/lib/ocaml/jsxEvent.ml +0 -358
  491. package/lib/ocaml/lazy.cmi +0 -0
  492. package/lib/ocaml/lazy.cmt +0 -0
  493. package/lib/ocaml/lazy.cmti +0 -0
  494. package/lib/ocaml/lazy.ml +0 -70
  495. package/lib/ocaml/lazy.mli +0 -95
  496. package/lib/ocaml/lexing.cmi +0 -0
  497. package/lib/ocaml/lexing.cmt +0 -0
  498. package/lib/ocaml/lexing.cmti +0 -0
  499. package/lib/ocaml/lexing.ml +0 -230
  500. package/lib/ocaml/lexing.mli +0 -172
  501. package/lib/ocaml/list.cmi +0 -0
  502. package/lib/ocaml/list.cmt +0 -0
  503. package/lib/ocaml/list.cmti +0 -0
  504. package/lib/ocaml/list.ml +0 -485
  505. package/lib/ocaml/list.mli +0 -347
  506. package/lib/ocaml/listLabels.cmi +0 -0
  507. package/lib/ocaml/listLabels.cmt +0 -0
  508. package/lib/ocaml/listLabels.cmti +0 -0
  509. package/lib/ocaml/listLabels.ml +0 -485
  510. package/lib/ocaml/listLabels.mli +0 -353
  511. package/lib/ocaml/map.cmi +0 -0
  512. package/lib/ocaml/map.cmt +0 -0
  513. package/lib/ocaml/map.cmti +0 -0
  514. package/lib/ocaml/map.cppo.ml +0 -174
  515. package/lib/ocaml/map.cppo.mli +0 -191
  516. package/lib/ocaml/map.ml +0 -480
  517. package/lib/ocaml/map.mli +0 -315
  518. package/lib/ocaml/mapLabels.cmi +0 -0
  519. package/lib/ocaml/mapLabels.cmt +0 -0
  520. package/lib/ocaml/mapLabels.ml +0 -480
  521. package/lib/ocaml/mapm.cppo.ml +0 -177
  522. package/lib/ocaml/mapm.cppo.mli +0 -138
  523. package/lib/ocaml/moreLabels.cmi +0 -0
  524. package/lib/ocaml/moreLabels.cmt +0 -0
  525. package/lib/ocaml/moreLabels.cmti +0 -0
  526. package/lib/ocaml/moreLabels.ml +0 -22
  527. package/lib/ocaml/moreLabels.mli +0 -198
  528. package/lib/ocaml/node.cmi +0 -0
  529. package/lib/ocaml/node.cmt +0 -0
  530. package/lib/ocaml/node.ml +0 -84
  531. package/lib/ocaml/node_buffer.cmi +0 -0
  532. package/lib/ocaml/node_buffer.cmt +0 -0
  533. package/lib/ocaml/node_buffer.ml +0 -47
  534. package/lib/ocaml/node_child_process.cmi +0 -0
  535. package/lib/ocaml/node_child_process.cmt +0 -0
  536. package/lib/ocaml/node_child_process.ml +0 -50
  537. package/lib/ocaml/node_fs.cmi +0 -0
  538. package/lib/ocaml/node_fs.cmt +0 -0
  539. package/lib/ocaml/node_fs.ml +0 -153
  540. package/lib/ocaml/node_module.cmi +0 -0
  541. package/lib/ocaml/node_module.cmt +0 -0
  542. package/lib/ocaml/node_module.ml +0 -29
  543. package/lib/ocaml/node_path.cmi +0 -0
  544. package/lib/ocaml/node_path.cmt +0 -0
  545. package/lib/ocaml/node_path.ml +0 -71
  546. package/lib/ocaml/node_process.cmi +0 -0
  547. package/lib/ocaml/node_process.cmt +0 -0
  548. package/lib/ocaml/node_process.cmti +0 -0
  549. package/lib/ocaml/node_process.ml +0 -59
  550. package/lib/ocaml/node_process.mli +0 -48
  551. package/lib/ocaml/obj.cmi +0 -0
  552. package/lib/ocaml/obj.cmt +0 -0
  553. package/lib/ocaml/obj.cmti +0 -0
  554. package/lib/ocaml/obj.ml +0 -29
  555. package/lib/ocaml/obj.mli +0 -62
  556. package/lib/ocaml/parsing.cmi +0 -0
  557. package/lib/ocaml/parsing.cmt +0 -0
  558. package/lib/ocaml/parsing.cmti +0 -0
  559. package/lib/ocaml/parsing.ml +0 -212
  560. package/lib/ocaml/parsing.mli +0 -105
  561. package/lib/ocaml/pervasives.cmi +0 -0
  562. package/lib/ocaml/pervasives.cmt +0 -0
  563. package/lib/ocaml/pervasives.cmti +0 -0
  564. package/lib/ocaml/pervasives.ml +0 -297
  565. package/lib/ocaml/pervasives.mli +0 -771
  566. package/lib/ocaml/printexc.cmi +0 -0
  567. package/lib/ocaml/printexc.cmt +0 -0
  568. package/lib/ocaml/printexc.cmti +0 -0
  569. package/lib/ocaml/printexc.ml +0 -79
  570. package/lib/ocaml/printexc.mli +0 -57
  571. package/lib/ocaml/queue.cmi +0 -0
  572. package/lib/ocaml/queue.cmt +0 -0
  573. package/lib/ocaml/queue.cmti +0 -0
  574. package/lib/ocaml/queue.ml +0 -132
  575. package/lib/ocaml/queue.mli +0 -82
  576. package/lib/ocaml/random.cmi +0 -0
  577. package/lib/ocaml/random.cmt +0 -0
  578. package/lib/ocaml/random.cmti +0 -0
  579. package/lib/ocaml/random.ml +0 -273
  580. package/lib/ocaml/random.mli +0 -102
  581. package/lib/ocaml/set.cmi +0 -0
  582. package/lib/ocaml/set.cmt +0 -0
  583. package/lib/ocaml/set.cmti +0 -0
  584. package/lib/ocaml/set.ml +0 -526
  585. package/lib/ocaml/set.mli +0 -266
  586. package/lib/ocaml/setLabels.cmi +0 -0
  587. package/lib/ocaml/setLabels.cmt +0 -0
  588. package/lib/ocaml/setLabels.ml +0 -526
  589. package/lib/ocaml/setm.cppo.ml +0 -346
  590. package/lib/ocaml/setm.cppo.mli +0 -126
  591. package/lib/ocaml/sort.cmi +0 -0
  592. package/lib/ocaml/sort.cmt +0 -0
  593. package/lib/ocaml/sort.cmti +0 -0
  594. package/lib/ocaml/sort.cppo.ml +0 -267
  595. package/lib/ocaml/sort.cppo.mli +0 -96
  596. package/lib/ocaml/sort.ml +0 -99
  597. package/lib/ocaml/sort.mli +0 -44
  598. package/lib/ocaml/stack.cmi +0 -0
  599. package/lib/ocaml/stack.cmt +0 -0
  600. package/lib/ocaml/stack.cmti +0 -0
  601. package/lib/ocaml/stack.ml +0 -44
  602. package/lib/ocaml/stack.mli +0 -63
  603. package/lib/ocaml/stdLabels.cmi +0 -0
  604. package/lib/ocaml/stdLabels.cmt +0 -0
  605. package/lib/ocaml/stdLabels.cmti +0 -0
  606. package/lib/ocaml/stdLabels.ml +0 -24
  607. package/lib/ocaml/stdLabels.mli +0 -29
  608. package/lib/ocaml/stream.cmi +0 -0
  609. package/lib/ocaml/stream.cmt +0 -0
  610. package/lib/ocaml/stream.cmti +0 -0
  611. package/lib/ocaml/stream.ml +0 -213
  612. package/lib/ocaml/stream.mli +0 -108
  613. package/lib/ocaml/string.cmi +0 -0
  614. package/lib/ocaml/string.cmt +0 -0
  615. package/lib/ocaml/string.cmti +0 -0
  616. package/lib/ocaml/string.ml +0 -190
  617. package/lib/ocaml/string.mli +0 -286
  618. package/lib/ocaml/stringLabels.cmi +0 -0
  619. package/lib/ocaml/stringLabels.cmt +0 -0
  620. package/lib/ocaml/stringLabels.cmti +0 -0
  621. package/lib/ocaml/stringLabels.ml +0 -190
  622. package/lib/ocaml/stringLabels.mli +0 -241
  623. package/lib/ocaml/sys.cmi +0 -0
  624. package/lib/ocaml/sys.cmt +0 -0
  625. package/lib/ocaml/sys.cmti +0 -0
  626. package/lib/ocaml/sys.ml +0 -135
  627. package/lib/ocaml/sys.mli +0 -333
  628. package/lib/ocaml/uchar.cmi +0 -0
  629. package/lib/ocaml/uchar.cmt +0 -0
  630. package/lib/ocaml/uchar.cmti +0 -0
  631. package/lib/ocaml/uchar.ml +0 -58
  632. package/lib/ocaml/uchar.mli +0 -98
  633. package/linux/bsb_helper.exe +0 -0
  634. package/linux/bsc.exe +0 -0
  635. package/linux/ninja.COPYING +0 -202
  636. package/linux/ninja.exe +0 -0
  637. package/linux/rescript.exe +0 -0
  638. package/openbsd/.keep +0 -0
  639. package/scripts/LICENSE.ml +0 -27
  640. package/scripts/buckle_lto.js +0 -55
  641. package/scripts/build_sorted.ml +0 -233
  642. package/scripts/caml_oo_curry_gen.ml +0 -71
  643. package/scripts/checkUnused.js +0 -63
  644. package/scripts/ciTest.js +0 -172
  645. package/scripts/cover.sh +0 -3
  646. package/scripts/curry_gen.ml +0 -167
  647. package/scripts/dbg +0 -13
  648. package/scripts/dedupe.js +0 -44
  649. package/scripts/doc_gen.js +0 -117
  650. package/scripts/js_internal_gen.js +0 -135
  651. package/scripts/jsconfig.json +0 -12
  652. package/scripts/littlecase.js +0 -21
  653. package/scripts/ninja.js +0 -1980
  654. package/scripts/pack.js +0 -107
  655. package/scripts/prebuilt.js +0 -99
  656. package/scripts/release.js +0 -41
  657. package/scripts/repl.js +0 -151
  658. package/scripts/shake.js +0 -138
  659. package/scripts/tasks.js +0 -149
  660. package/scripts/test.sh +0 -3
  661. package/scripts/tmp.js +0 -98
  662. package/scripts/validate.js +0 -41
  663. package/vendor/ninja.tar.gz +0 -0
  664. package/win32/bsb_helper.exe +0 -0
  665. package/win32/bsc.exe +0 -0
  666. package/win32/ninja.COPYING +0 -202
  667. package/win32/ninja.exe +0 -0
  668. package/win32/rescript.exe +0 -0
@@ -1,970 +0,0 @@
1
- (* Copyright (C) 2015-2016 Bloomberg Finance L.P.
2
- *
3
- * This program is free software: you can redistribute it and/or modify
4
- * it under the terms of the GNU Lesser General Public License as published by
5
- * the Free Software Foundation, either version 3 of the License, or
6
- * (at your option) any later version.
7
- *
8
- * In addition to the permissions granted to you by the LGPL, you may combine
9
- * or link a "work that uses the Library" with a publicly distributed version
10
- * of this file to produce a combined library or application, then distribute
11
- * that combined work under the terms of your choosing, with no requirement
12
- * to comply with the obligations normally placed on you by section 4 of the
13
- * LGPL version 3 (or the corresponding section of a later version of the LGPL
14
- * should you choose to use a later version).
15
- *
16
- * This program is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Lesser General Public License
22
- * along with this program; if not, write to the Free Software
23
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
24
-
25
- (**
26
- Provides bindings to JavaScript’s `Array` functions. These bindings are
27
- optimized for pipe-last (`|>`), where the array to be processed is the last
28
- parameter in the function.
29
-
30
- Here is an example to find the sum of squares of all even numbers in an array.
31
- Without pipe last, we must call the functions in reverse order:
32
-
33
- ```res example
34
- let isEven = x => mod(x, 2) == 0
35
- let square = x => x * x
36
- let result = {
37
- open Js.Array
38
- reduce(\"+", 0, map(square, filter(isEven, [5, 2, 3, 4, 1])))
39
- }
40
- ```
41
-
42
- With pipe last, we call the functions in the “natural” order:
43
-
44
- ```res example
45
- let isEven = x => mod(x, 2) == 0
46
- let square = x => x * x
47
- let result = {
48
- open Js.Array
49
- [5, 2, 3, 4, 1] |> filter(isEven) |> map(square) |> reduce(\"+", 0)
50
- }
51
- ```
52
- *)
53
-
54
- [@@@warning "-103"]
55
-
56
- type 'a t = 'a array
57
- (**
58
- The type used to describe a JavaScript array.
59
- *)
60
-
61
- type 'a array_like = 'a Js_array2.array_like
62
- (**
63
- A type used to describe JavaScript objects that are like an array or are iterable.
64
- *)
65
-
66
- (* commented out until bs has a plan for iterators
67
- type 'a array_iter = 'a array_like
68
- *)
69
-
70
- external from : 'a array_like -> 'a array = "Array.from"
71
- [@@bs.val]
72
- (**
73
- Creates a shallow copy of an array from an array-like object. See [`Array.from`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from) on MDN.
74
-
75
- ```res example
76
- let strArr = Js.String.castToArrayLike("abcd")
77
- Js.Array.from(strArr) == ["a", "b", "c", "d"]
78
- ```
79
- *)
80
- (* ES2015 *)
81
-
82
- external fromMap : 'a array_like -> (('a -> 'b)[@bs.uncurry]) -> 'b array
83
- = "Array.from"
84
- [@@bs.val]
85
- (**
86
- Creates a new array by applying a function (the second argument) to each item
87
- in the `array_like` first argument. See
88
- [`Array.from`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from)
89
- on MDN.
90
-
91
- ```res example
92
- let strArr = Js.String.castToArrayLike("abcd")
93
- let code = s => Js.String.charCodeAt(0, s)
94
- Js.Array.fromMap(strArr, code) == [97.0, 98.0, 99.0, 100.0]
95
- ```
96
- *)
97
- (* ES2015 *)
98
-
99
- external isArray : 'a -> bool = "Array.isArray" [@@bs.val]
100
- (* ES2015 *)
101
- (*
102
- Returns `true` if its argument is an array; `false` otherwise. This is a
103
- runtime check, which is why the second example returns `true` — a list is
104
- internally represented as a nested JavaScript array.
105
-
106
- ```res example
107
- Js.Array.isArray([5, 2, 3, 1, 4]) == true
108
- Js.Array.isArray(list{5, 2, 3, 1, 4}) == true
109
- Js.Array.isArray("abcd") == false
110
- ```
111
- *)
112
-
113
- external length : 'a array -> int = "length"
114
- [@@bs.get]
115
- (**
116
- Returns the number of elements in the array. See [`Array.length`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/length) on MDN.
117
- *)
118
-
119
- (* Mutator functions *)
120
-
121
- external copyWithin : to_:int -> 'this = "copyWithin"
122
- [@@bs.send.pipe: 'a t as 'this]
123
- (**
124
- Copies from the first element in the given array to the designated `~to_` position, returning the resulting array. *This function modifies the original array.* See [`Array.copyWithin`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin) on MDN.
125
-
126
- ```res example
127
- let arr = [100, 101, 102, 103, 104]
128
- Js.Array.copyWithin(~to_=2, arr) == [100, 101, 100, 101, 102]
129
- arr == [100, 101, 100, 101, 102]
130
- ```
131
- *)
132
- (* ES2015 *)
133
-
134
- external copyWithinFrom : to_:int -> from:int -> 'this = "copyWithin"
135
- [@@bs.send.pipe: 'a t as 'this]
136
- (**
137
- Copies starting at element `~from` in the given array to the designated `~to_` position, returning the resulting array. *This function modifies the original array.* See [`Array.copyWithin`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin) on MDN.
138
-
139
- ```res example
140
- let arr = [100, 101, 102, 103, 104]
141
- Js.Array.copyWithinFrom(~from=2, ~to_=0, arr) == [102, 103, 104, 103, 104]
142
- arr == [102, 103, 104, 103, 104]
143
- ```
144
- *)
145
- (* ES2015 *)
146
-
147
- external copyWithinFromRange : to_:int -> start:int -> end_:int -> 'this
148
- = "copyWithin"
149
- [@@bs.send.pipe: 'a t as 'this]
150
- (**
151
- Copies starting at element `~start` in the given array up to but not including `~end_` to the designated `~to_` position, returning the resulting array. *This function modifies the original array.* See [`Array.copyWithin`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin) on MDN.
152
-
153
- ```res example
154
- let arr = [100, 101, 102, 103, 104, 105]
155
- Js.Array.copyWithinFromRange(~start=2, ~end_=5, ~to_=1, arr) == [100, 102, 103, 104, 104, 105]
156
- arr == [100, 102, 103, 104, 104, 105]
157
- ```
158
- *)
159
- (* ES2015 *)
160
-
161
- external fillInPlace : 'a -> 'this = "fill"
162
- [@@bs.send.pipe: 'a t as 'this]
163
- (**
164
- Sets all elements of the given array (the second arumgent) to the designated value (the first argument), returning the resulting array. *This function modifies the original array.* See [`Array.fill`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill) on MDN.
165
-
166
- ```res example
167
- let arr = [100, 101, 102, 103, 104]
168
- Js.Array.fillInPlace(99, arr) == [99, 99, 99, 99, 99]
169
- arr == [99, 99, 99, 99, 99]
170
- ```
171
- *)
172
- (* ES2015 *)
173
-
174
- external fillFromInPlace : 'a -> from:int -> 'this = "fill"
175
- [@@bs.send.pipe: 'a t as 'this]
176
- (**
177
- Sets all elements of the given array (the last arumgent) from position `~from` to the end to the designated value (the first argument), returning the resulting array. *This function modifies the original array.* See [`Array.fill`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill) on MDN.
178
-
179
- ```res example
180
- let arr = [100, 101, 102, 103, 104]
181
- Js.Array.fillFromInPlace(99, ~from=2, arr) == [100, 101, 99, 99, 99]
182
- arr == [100, 101, 99, 99, 99]
183
- ```
184
- *)
185
- (* ES2015 *)
186
-
187
- external fillRangeInPlace : 'a -> start:int -> end_:int -> 'this = "fill"
188
- [@@bs.send.pipe: 'a t as 'this]
189
- (**
190
- Sets the elements of the given array (the last arumgent) from position `~start` up to but not including position `~end_` to the designated value (the first argument), returning the resulting array. *This function modifies the original array.* See [`Array.fill`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill) on MDN.
191
-
192
- ```res example
193
- let arr = [100, 101, 102, 103, 104]
194
- Js.Array.fillRangeInPlace(99, ~start=1, ~end_=4, arr) == [100, 99, 99, 99, 104]
195
- arr == [100, 99, 99, 99, 104]
196
- ```
197
- *)
198
- (* ES2015 *)
199
-
200
- external pop : 'a option = "pop"
201
- [@@bs.send.pipe: 'a t as 'this] [@@bs.return undefined_to_opt]
202
- (**
203
- If the array is not empty, removes the last element and returns it as `Some(value)`; returns `None` if the array is empty. *This function modifies the original array.* See [`Array.pop`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop) on MDN.
204
-
205
- ```res example
206
- let arr = [100, 101, 102, 103, 104]
207
- Js.Array.pop(arr) == Some(104)
208
- arr == [100, 101, 102, 103]
209
-
210
- let empty: array<int> = []
211
- Js.Array.pop(empty) == None
212
- ```
213
- *)
214
-
215
- external push : 'a -> int = "push"
216
- [@@bs.send.pipe: 'a t as 'this]
217
- (**
218
- Appends the given value to the array, returning the number of elements in the updated array. *This function modifies the original array.* See [`Array.push`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push) on MDN.
219
-
220
- ```res example
221
- let arr = ["ant", "bee", "cat"]
222
- Js.Array.push("dog", arr) == 4
223
- arr == ["ant", "bee", "cat", "dog"]
224
- ```
225
- *)
226
-
227
- external pushMany : 'a array -> int = "push"
228
- [@@bs.send.pipe: 'a t as 'this] [@@bs.splice]
229
- (**
230
- Appends the values from one array (the first argument) to another (the second argument), returning the number of elements in the updated array. *This function modifies the original array.* See [`Array.push`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push) on MDN.
231
-
232
- ```res example
233
- let arr = ["ant", "bee", "cat"]
234
- Js.Array.pushMany(["dog", "elk"], arr) == 5
235
- arr == ["ant", "bee", "cat", "dog", "elk"]
236
- ```
237
- *)
238
-
239
- external reverseInPlace : 'this = "reverse"
240
- [@@bs.send.pipe: 'a t as 'this]
241
- (**
242
- Returns an array with the elements of the input array in reverse order. *This function modifies the original array.* See [`Array.reverse`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse) on MDN.
243
-
244
- ```res example
245
- let arr = ["ant", "bee", "cat"]
246
- Js.Array.reverseInPlace(arr) == ["cat", "bee", "ant"]
247
- arr == ["cat", "bee", "ant"]
248
- ```
249
- *)
250
-
251
- external shift : 'a option = "shift"
252
- [@@bs.send.pipe: 'a t as 'this] [@@bs.return { undefined_to_opt }]
253
- (**
254
- If the array is not empty, removes the first element and returns it as `Some(value)`; returns `None` if the array is empty. *This function modifies the original array.* See [`Array.shift`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift) on MDN.
255
-
256
- ```res example
257
- let arr = [100, 101, 102, 103, 104]
258
- Js.Array.shift(arr) == Some(100)
259
- arr == [101, 102, 103, 104]
260
-
261
- let empty: array<int> = []
262
- Js.Array.shift(empty) == None
263
- ```
264
- *)
265
-
266
- external sortInPlace : 'this = "sort"
267
- [@@bs.send.pipe: 'a t as 'this]
268
- (**
269
- Sorts the given array in place and returns the sorted array. JavaScript sorts the array by converting the arguments to UTF-16 strings and sorting them. See the second example with sorting numbers, which does not do a numeric sort. *This function modifies the original array.* See [`Array.sort`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) on MDN.
270
-
271
- ```res example
272
- let words = ["bee", "dog", "ant", "cat"]
273
- Js.Array.sortInPlace(words) == ["ant", "bee", "cat", "dog"]
274
- words == ["ant", "bee", "cat", "dog"]
275
-
276
- let numbers = [3, 30, 10, 1, 20, 2]
277
- Js.Array.sortInPlace(numbers) == [1, 10, 2, 20, 3, 30]
278
- numbers == [1, 10, 2, 20, 3, 30]
279
- ```
280
- *)
281
-
282
- external sortInPlaceWith : (('a -> 'a -> int)[@bs.uncurry]) -> 'this = "sort"
283
- [@@bs.send.pipe: 'a t as 'this]
284
- (**
285
- Sorts the given array in place and returns the sorted array. *This function modifies the original array.*
286
-
287
- The first argument to `sortInPlaceWith()` is a function that compares two items from the array and returns:
288
-
289
- * an integer less than zero if the first item is less than the second item
290
- * zero if the items are equal
291
- * an integer greater than zero if the first item is greater than the second item
292
-
293
- See [`Array.sort`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) on MDN.
294
-
295
- ```res example
296
- // sort by word length
297
- let words = ["horse", "aardvark", "dog", "camel"]
298
- let byLength = (s1, s2) => Js.String.length(s1) - Js.String.length(s2)
299
-
300
- Js.Array.sortInPlaceWith(byLength, words) == ["dog", "horse", "camel", "aardvark"]
301
-
302
- // sort in reverse numeric order
303
- let numbers = [3, 30, 10, 1, 20, 2]
304
- let reverseNumeric = (n1, n2) => n2 - n1
305
- Js.Array.sortInPlaceWith(reverseNumeric, numbers) == [30, 20, 10, 3, 2, 1]
306
- ```
307
- *)
308
-
309
- external spliceInPlace : pos:int -> remove:int -> add:'a array -> 'this
310
- = "splice"
311
- [@@bs.send.pipe: 'a t as 'this] [@@bs.splice]
312
- (**
313
- Starting at position `~pos`, remove `~remove` elements and then add the
314
- elements from the `~add` array. Returns an array consisting of the removed
315
- items. *This function modifies the original array.* See
316
- [`Array.splice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice)
317
- on MDN.
318
-
319
- ```res example
320
- let arr = ["a", "b", "c", "d", "e", "f"]
321
- Js.Array.spliceInPlace(~pos=2, ~remove=2, ~add=["x", "y", "z"], arr) == ["c", "d"]
322
- arr == ["a", "b", "x", "y", "z", "e", "f"]
323
-
324
- let arr2 = ["a", "b", "c", "d"]
325
- Js.Array.spliceInPlace(~pos=3, ~remove=0, ~add=["x", "y"], arr2) == []
326
- arr2 == ["a", "b", "c", "x", "y", "d"]
327
-
328
- let arr3 = ["a", "b", "c", "d", "e", "f"]
329
- Js.Array.spliceInPlace(~pos=9, ~remove=2, ~add=["x", "y", "z"], arr3) == []
330
- arr3 == ["a", "b", "c", "d", "e", "f", "x", "y", "z"]
331
- ```
332
- *)
333
-
334
- external removeFromInPlace : pos:int -> 'this = "splice"
335
- [@@bs.send.pipe: 'a t as 'this]
336
- (**
337
- Removes elements from the given array starting at position `~pos` to the end
338
- of the array, returning the removed elements. *This function modifies the
339
- original array.* See
340
- [`Array.splice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice)
341
- on MDN.
342
-
343
- ```res example
344
- let arr = ["a", "b", "c", "d", "e", "f"]
345
- Js.Array.removeFromInPlace(~pos=4, arr) == ["e", "f"]
346
- arr == ["a", "b", "c", "d"]
347
- ```
348
- *)
349
-
350
- external removeCountInPlace : pos:int -> count:int -> 'this = "splice"
351
- [@@bs.send.pipe: 'a t as 'this]
352
- (**
353
- Removes `~count` elements from the given array starting at position `~pos`,
354
- returning the removed elements. *This function modifies the original array.*
355
- See
356
- [`Array.splice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice)
357
- on MDN.
358
-
359
- ```res example
360
- let arr = ["a", "b", "c", "d", "e", "f"]
361
- Js.Array.removeCountInPlace(~pos=2, ~count=3, arr) == ["c", "d", "e"]
362
- arr == ["a", "b", "f"]
363
- ```
364
- *)
365
-
366
- external unshift : 'a -> int = "unshift"
367
- [@@bs.send.pipe: 'a t as 'this]
368
- (**
369
- Adds the given element to the array, returning the new number of elements in
370
- the array. *This function modifies the original array.* See
371
- [`Array.unshift`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift)
372
- on MDN.
373
-
374
- ```res example
375
- let arr = ["b", "c", "d"]
376
- Js.Array.unshift("a", arr) == 4
377
- arr == ["a", "b", "c", "d"]
378
- ```
379
- *)
380
-
381
- external unshiftMany : 'a array -> int = "unshift"
382
- [@@bs.send.pipe: 'a t as 'this] [@@bs.splice]
383
- (**
384
- Adds the elements in the first array argument at the beginning of the second
385
- array argument, returning the new number of elements in the array. *This
386
- function modifies the original array.* See
387
- [`Array.unshift`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift)
388
- on MDN.
389
-
390
- ```res example
391
- let arr = ["d", "e"]
392
- Js.Array.unshiftMany(["a", "b", "c"], arr) == 5
393
- arr == ["a", "b", "c", "d", "e"]
394
- ```
395
- *)
396
-
397
- (* Accessor functions
398
- *)
399
- external concat : 'this -> 'this = "concat"
400
- [@@bs.send.pipe: 'a t as 'this]
401
- (**
402
- Concatenates the first array argument to the second array argument, returning
403
- a new array. The original arrays are not modified. See
404
- [`Array.concat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat)
405
- on MDN.
406
-
407
- ```res example
408
- Js.Array.concat(["c", "d", "e"], ["a", "b"]) == ["a", "b", "c", "d", "e"]
409
- ```
410
- *)
411
-
412
- external concatMany : 'this array -> 'this = "concat"
413
- [@@bs.send.pipe: 'a t as 'this] [@@bs.splice]
414
- (**
415
- The first argument to `concatMany()` is an array of arrays; these are added
416
- at the end of the second argument, returning a new array. See
417
- [`Array.concat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat)
418
- on MDN.
419
-
420
- ```res example
421
- Js.Array.concatMany([["d", "e"], ["f", "g", "h"]], ["a", "b", "c"]) == [
422
- "a",
423
- "b",
424
- "c",
425
- "d",
426
- "e",
427
- "f",
428
- "g",
429
- "h",
430
- ]
431
- ```
432
- *)
433
-
434
- (* ES2016 *)
435
- external includes : 'a -> bool = "includes"
436
- [@@bs.send.pipe: 'a t as 'this]
437
- (**
438
- Returns true if the given value is in the array, `false` otherwise. See
439
- [`Array.includes`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes)
440
- on MDN.
441
-
442
- ```res example
443
- Js.Array.includes("b", ["a", "b", "c"]) == true
444
- Js.Array.includes("x", ["a", "b", "c"]) == false
445
- ```
446
- *)
447
-
448
- external indexOf : 'a -> int = "indexOf"
449
- [@@bs.send.pipe: 'a t as 'this]
450
- (**
451
- Returns the index of the first element in the array that has the given value.
452
- If the value is not in the array, returns -1. See
453
- [`Array.indexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf)
454
- on MDN.
455
-
456
- ```res example
457
- Js.Array.indexOf(102, [100, 101, 102, 103]) == 2
458
- Js.Array.indexOf(999, [100, 101, 102, 103]) == -1
459
- ```
460
- *)
461
-
462
- external indexOfFrom : 'a -> from:int -> int = "indexOf"
463
- [@@bs.send.pipe: 'a t as 'this]
464
- (**
465
- Returns the index of the first element in the array with the given value. The
466
- search starts at position `~from`. See
467
- [`Array.indexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf)
468
- on MDN.
469
-
470
- ```res example
471
- Js.Array.indexOfFrom("a", ~from=2, ["a", "b", "a", "c", "a"]) == 2
472
- Js.Array.indexOfFrom("a", ~from=3, ["a", "b", "a", "c", "a"]) == 4
473
- Js.Array.indexOfFrom("b", ~from=2, ["a", "b", "a", "c", "a"]) == -1
474
- ```
475
- *)
476
-
477
- external join : 'a t -> string = "join"
478
- [@@bs.send] [@@deprecated "please use joinWith instead"]
479
- (**
480
- @deprecated: Use `joinWith` instead.
481
- *)
482
-
483
- external joinWith : string -> string = "join"
484
- [@@bs.send.pipe: 'a t as 'this]
485
- (**
486
- This function converts each element of the array to a string (via JavaScript)
487
- and concatenates them, separated by the string given in the first argument,
488
- into a single string. See
489
- [`Array.join`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join)
490
- on MDN.
491
-
492
- ```res example
493
- Js.Array.joinWith("--", ["ant", "bee", "cat"]) == "ant--bee--cat"
494
- Js.Array.joinWith("", ["door", "bell"]) == "doorbell"
495
- Js.Array.joinWith("/", [2020, 9, 4]) == "2020/9/4"
496
- Js.Array.joinWith(";", [2.5, 3.6, 3e-2]) == "2.5;3.6;0.03"
497
- ```
498
- *)
499
-
500
- external lastIndexOf : 'a -> int = "lastIndexOf"
501
- [@@bs.send.pipe: 'a t as 'this]
502
- (**
503
- Returns the index of the last element in the array that has the given value.
504
- If the value is not in the array, returns -1. See
505
- [`Array.lastIndexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf)
506
- on MDN.
507
-
508
- ```res example
509
- Js.Array.lastIndexOf("a", ["a", "b", "a", "c"]) == 2
510
- Js.Array.lastIndexOf("x", ["a", "b", "a", "c"]) == -1
511
- ```
512
- *)
513
-
514
- external lastIndexOfFrom : 'a -> from:int -> int = "lastIndexOf"
515
- [@@bs.send.pipe: 'a t as 'this]
516
- (**
517
- Returns the index of the last element in the array that has the given value,
518
- searching from position `~from` down to the start of the array. If the value
519
- is not in the array, returns -1. See
520
- [`Array.lastIndexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf)
521
- on MDN.
522
-
523
- ```res example
524
- Js.Array.lastIndexOfFrom("a", ~from=3, ["a", "b", "a", "c", "a", "d"]) == 2
525
- Js.Array.lastIndexOfFrom("c", ~from=2, ["a", "b", "a", "c", "a", "d"]) == -1
526
- ```
527
- *)
528
-
529
- external slice : start:int -> end_:int -> 'this = "slice"
530
- [@@bs.send.pipe: 'a t as 'this]
531
- (**
532
- Returns a shallow copy of the given array from the `~start` index up to but
533
- not including the `~end_` position. Negative numbers indicate an offset from
534
- the end of the array. See
535
- [`Array.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice)
536
- on MDN.
537
-
538
- ```res example
539
- let arr = [100, 101, 102, 103, 104, 105, 106]
540
- Js.Array.slice(~start=2, ~end_=5, arr) == [102, 103, 104]
541
- Js.Array.slice(~start=-3, ~end_=-1, arr) == [104, 105]
542
- Js.Array.slice(~start=9, ~end_=10, arr) == []
543
- ```
544
- *)
545
-
546
- external copy : 'this = "slice"
547
- [@@bs.send.pipe: 'a t as 'this]
548
- (**
549
- Returns a copy of the entire array. Same as `Js.Array.Slice(~start=0,
550
- ~end_=Js.Array.length(arr), arr)`. See
551
- [`Array.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice)
552
- on MDN.
553
- *)
554
-
555
- external sliceFrom : int -> 'this = "slice"
556
- [@@bs.send.pipe: 'a t as 'this]
557
- (**
558
- Returns a shallow copy of the given array from the given index to the end. See [`Array.slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice) on MDN.
559
-
560
- ```res example
561
- Js.Array.sliceFrom(2, [100, 101, 102, 103, 104]) == [102, 103, 104]
562
- ```
563
- *)
564
-
565
- external toString : string = "toString"
566
- [@@bs.send.pipe: 'a t as 'this]
567
- (**
568
- Converts the array to a string. Each element is converted to a string using
569
- JavaScript. Unlike the JavaScript `Array.toString()`, all elements in a
570
- ReasonML array must have the same type. See
571
- [`Array.toString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toString)
572
- on MDN.
573
-
574
- ```res example
575
- Js.Array.toString([3.5, 4.6, 7.8]) == "3.5,4.6,7.8"
576
- Js.Array.toString(["a", "b", "c"]) == "a,b,c"
577
- ```
578
- *)
579
-
580
- external toLocaleString : string = "toLocaleString"
581
- [@@bs.send.pipe: 'a t as 'this]
582
- (**
583
- Converts the array to a string using the conventions of the current locale.
584
- Each element is converted to a string using JavaScript. Unlike the JavaScript
585
- `Array.toLocaleString()`, all elements in a ReasonML array must have the same
586
- type. See
587
- [`Array.toLocaleString`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/toLocaleString)
588
- on MDN.
589
-
590
- ```res example
591
- Js.Array.toLocaleString([Js.Date.make()])
592
- // returns "3/19/2020, 10:52:11 AM" for locale en_US.utf8
593
- // returns "2020-3-19 10:52:11" for locale de_DE.utf8
594
- ```
595
- *)
596
-
597
- (* Iteration functions
598
- *)
599
- (* commented out until bs has a plan for iterators
600
- external entries : (int * 'a) array_iter = "" [@@bs.send.pipe: 'a t as 'this] (* ES2015 *)
601
- *)
602
-
603
- external every : (('a -> bool)[@bs.uncurry]) -> bool = "every"
604
- [@@bs.send.pipe: 'a t as 'this]
605
- (**
606
- The first argument to `every()` is a predicate function that returns a boolean. The `every()` function returns `true` if the predicate function is true for all items in the given array. If given an empty array, returns `true`. See [`Array.every`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every) on MDN.
607
-
608
- ```res example
609
- let isEven = x => mod(x, 2) == 0
610
- Js.Array.every(isEven, [6, 22, 8, 4]) == true
611
- Js.Array.every(isEven, [6, 22, 7, 4]) == false
612
- ```
613
- *)
614
-
615
- external everyi : (('a -> int -> bool)[@bs.uncurry]) -> bool = "every"
616
- [@@bs.send.pipe: 'a t as 'this]
617
- (**
618
- The first argument to `everyi()` is a predicate function with two arguments: an array element and that element’s index; it returns a boolean. The `everyi()` function returns `true` if the predicate function is true for all items in the given array. If given an empty array, returns `true`. See [`Array.every`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every) on MDN.
619
-
620
- ```res example
621
- // determine if all even-index items are positive
622
- let evenIndexPositive = (item, index) => mod(index, 2) == 0 ? item > 0 : true
623
-
624
- Js.Array.everyi(evenIndexPositive, [6, -3, 5, 8]) == true
625
- Js.Array.everyi(evenIndexPositive, [6, 3, -5, 8]) == false
626
- ```
627
- *)
628
-
629
- external filter : (('a -> bool)[@bs.uncurry]) -> 'this = "filter"
630
- [@@bs.send.pipe: 'a t as 'this]
631
- (**
632
- Applies the given predicate function to each element in the array; the result is an array of those elements for which the predicate function returned `true`. See [`Array.filter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) on MDN.
633
-
634
- ```res example
635
- let nonEmpty = s => s != ""
636
- Js.Array.filter(nonEmpty, ["abc", "", "", "def", "ghi"]) == ["abc", "def", "ghi"]
637
- ```
638
- *)
639
-
640
- external filteri : (('a -> int -> bool)[@bs.uncurry]) -> 'this = "filter"
641
- [@@bs.send.pipe: 'a t as 'this]
642
- (**
643
- Each element of the given array are passed to the predicate function. The
644
- return value is an array of all those elements for which the predicate
645
- function returned `true`. See
646
- [`Array.filter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)
647
- on MDN.
648
-
649
- ```res example
650
- // keep only positive elements at odd indices
651
- let positiveOddElement = (item, index) => mod(index, 2) == 1 && item > 0
652
-
653
- Js.Array.filteri(positiveOddElement, [6, 3, 5, 8, 7, -4, 1]) == [3, 8]
654
- ```
655
- *)
656
-
657
- external find : (('a -> bool)[@bs.uncurry]) -> 'a option = "find"
658
- [@@bs.send.pipe: 'a t as 'this] [@@bs.return { undefined_to_opt }]
659
- (**
660
- Returns `Some(value)` for the first element in the array that satisifies the
661
- given predicate function, or `None` if no element satisifies the predicate.
662
- See
663
- [`Array.find`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
664
- on MDN.
665
-
666
- ```res example
667
- // find first negative element
668
- Js.Array.find(x => x < 0, [33, 22, -55, 77, -44]) == Some(-55)
669
- Js.Array.find(x => x < 0, [33, 22, 55, 77, 44]) == None
670
- ```
671
- *)
672
-
673
- external findi : (('a -> int -> bool)[@bs.uncurry]) -> 'a option = "find"
674
- [@@bs.send.pipe: 'a t as 'this] [@@bs.return { undefined_to_opt }]
675
- (**
676
- Returns `Some(value)` for the first element in the array that satisifies the given predicate function, or `None` if no element satisifies the predicate. The predicate function takes an array element and an index as its parameters. See [`Array.find`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) on MDN.
677
-
678
- ```res example
679
- // find first positive item at an odd index
680
- let positiveOddElement = (item, index) => mod(index, 2) == 1 && item > 0
681
-
682
- Js.Array.findi(positiveOddElement, [66, -33, 55, 88, 22]) == Some(88)
683
- Js.Array.findi(positiveOddElement, [66, -33, 55, -88, 22]) == None
684
- ```
685
- *)
686
-
687
- external findIndex : (('a -> bool)[@bs.uncurry]) -> int = "findIndex"
688
- [@@bs.send.pipe: 'a t as 'this]
689
- (**
690
- Returns the index of the first element in the array that satisifies the given predicate function, or -1 if no element satisifies the predicate. See [`Array.find`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) on MDN.
691
-
692
- ```res example
693
- Js.Array.findIndex(x => x < 0, [33, 22, -55, 77, -44]) == 2
694
- Js.Array.findIndex(x => x < 0, [33, 22, 55, 77, 44]) == -1
695
- ```
696
- *)
697
-
698
- external findIndexi : (('a -> int -> bool)[@bs.uncurry]) -> int = "findIndex"
699
- [@@bs.send.pipe: 'a t as 'this]
700
- (**
701
- Returns `Some(value)` for the first element in the array that satisifies the given predicate function, or `None` if no element satisifies the predicate. The predicate function takes an array element and an index as its parameters. See [`Array.find`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) on MDN.
702
-
703
- ```res example
704
- // find index of first positive item at an odd index
705
- let positiveOddElement = (item, index) => mod(index, 2) == 1 && item > 0
706
-
707
- Js.Array.findIndexi(positiveOddElement, [66, -33, 55, 88, 22]) == 3
708
- Js.Array.findIndexi(positiveOddElement, [66, -33, 55, -88, 22]) == -1
709
- ```
710
- *)
711
-
712
- external forEach : (('a -> unit)[@bs.uncurry]) -> unit = "forEach"
713
- [@@bs.send.pipe: 'a t as 'this]
714
- (**
715
- The `forEach()` function applies the function given as the first argument to each element in the array. The function you provide returns `unit`, and the `forEach()` function also returns `unit`. You use `forEach()` when you need to process each element in the array but not return any new array or value; for example, to print the items in an array. See [`Array.forEach`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) on MDN.
716
-
717
- ```res example
718
- // display all elements in an array
719
- Js.Array.forEach(x => Js.log(x), ["a", "b", "c"]) == ()
720
- ```
721
- *)
722
-
723
- external forEachi : (('a -> int -> unit)[@bs.uncurry]) -> unit = "forEach"
724
- [@@bs.send.pipe: 'a t as 'this]
725
- (**
726
- The `forEachi()` function applies the function given as the first argument to each element in the array. The function you provide takes an item in the array and its index number, and returns `unit`. The `forEachi()` function also returns `unit`. You use `forEachi()` when you need to process each element in the array but not return any new array or value; for example, to print the items in an array. See [`Array.forEach`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) on MDN.
727
-
728
- ```res example
729
- // display all elements in an array as a numbered list
730
- Js.Array.forEachi((item, index) => Js.log2(index + 1, item), ["a", "b", "c"]) == ()
731
- ```
732
- *)
733
-
734
- (* commented out until bs has a plan for iterators
735
- external keys : int array_iter = "" [@@bs.send.pipe: 'a t as 'this] (* ES2015 *)
736
- *)
737
-
738
- external map : (('a -> 'b)[@bs.uncurry]) -> 'b t = "map"
739
- [@@bs.send.pipe: 'a t as 'this]
740
- (**
741
- Applies the function (given as the first argument) to each item in the array,
742
- returning a new array. The result array does not have to have elements of the
743
- same type as the input array. See
744
- [`Array.map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
745
- on MDN.
746
-
747
- ```res example
748
- Js.Array.map(x => x * x, [12, 4, 8]) == [144, 16, 64]
749
- Js.Array.map(Js.String.length, ["animal", "vegetable", "mineral"]) == [6, 9, 7]
750
- ```
751
- *)
752
-
753
- external mapi : (('a -> int -> 'b)[@bs.uncurry]) -> 'b t = "map"
754
- [@@bs.send.pipe: 'a t as 'this]
755
- (**
756
- Applies the function (given as the first argument) to each item in the array,
757
- returning a new array. The function acceps two arguments: an item from the
758
- array and its index number. The result array does not have to have elements
759
- of the same type as the input array. See
760
- [`Array.map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
761
- on MDN.
762
-
763
- ```res example
764
- // multiply each item in array by its position
765
- let product = (item, index) => item * index
766
- Js.Array.mapi(product, [10, 11, 12]) == [0, 11, 24]
767
- ```
768
- *)
769
-
770
- external reduce : (('b -> 'a -> 'b)[@bs.uncurry]) -> 'b -> 'b = "reduce"
771
- [@@bs.send.pipe: 'a t as 'this]
772
- (**
773
- The `reduce()` function takes three parameters: a *reducer function*, a
774
- beginning accumulator value, and an array. The reducer function has two
775
- parameters: an accumulated value and an element of the array.
776
-
777
- `reduce()` first calls the reducer function with the beginning value and the
778
- first element in the array. The result becomes the new accumulator value, which
779
- is passed in to the reducer function along with the second element in the
780
- array. `reduce()` proceeds through the array, passing in the result of each
781
- stage as the accumulator to the reducer function.
782
-
783
- When all array elements are processed, the final value of the accumulator
784
- becomes the return value of `reduce()`. See
785
- [`Array.reduce`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)
786
- on MDN.
787
-
788
- ```res example
789
- let sumOfSquares = (accumulator, item) => accumulator + item * item
790
-
791
- Js.Array.reduce(sumOfSquares, 0, [10, 2, 4]) == 120
792
- Js.Array.reduce(\"*", 1, [10, 2, 4]) == 80
793
- Js.Array.reduce(
794
- (acc, item) => acc + Js.String.length(item),
795
- 0,
796
- ["animal", "vegetable", "mineral"],
797
- ) == 22 // 6 + 9 + 7
798
- Js.Array.reduce((acc, item) => item /. acc, 1.0, [2.0, 4.0]) == 2.0 // 4.0 / (2.0 / 1.0)
799
- ```
800
- *)
801
-
802
- external reducei : (('b -> 'a -> int -> 'b)[@bs.uncurry]) -> 'b -> 'b = "reduce"
803
- [@@bs.send.pipe: 'a t as 'this]
804
- (**
805
- The `reducei()` function takes three parameters: a *reducer function*, a
806
- beginning accumulator value, and an array. The reducer function has three
807
- parameters: an accumulated value, an element of the array, and the index of
808
- that element.
809
-
810
- `reducei()` first calls the reducer function with the beginning value, the
811
- first element in the array, and zero (its index). The result becomes the new
812
- accumulator value, which is passed to the reducer function along with the
813
- second element in the array and one (its index). `reducei()` proceeds from left
814
- to right through the array, passing in the result of each stage as the
815
- accumulator to the reducer function.
816
-
817
- When all array elements are processed, the final value of the accumulator
818
- becomes the return value of `reducei()`. See
819
- [`Array.reduce`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)
820
- on MDN.
821
-
822
- ```res example
823
- // find sum of even-index elements in array
824
- let sumOfEvens = (accumulator, item, index) =>
825
- if mod(index, 2) == 0 {
826
- accumulator + item
827
- } else {
828
- accumulator
829
- }
830
-
831
- Js.Array.reducei(sumOfEvens, 0, [2, 5, 1, 4, 3]) == 6
832
- ```
833
- *)
834
-
835
- external reduceRight : (('b -> 'a -> 'b)[@bs.uncurry]) -> 'b -> 'b
836
- = "reduceRight"
837
- [@@bs.send.pipe: 'a t as 'this]
838
- (**
839
- The `reduceRight()` function takes three parameters: a *reducer function*, a
840
- beginning accumulator value, and an array. The reducer function has two
841
- parameters: an accumulated value and an element of the array.
842
-
843
- `reduceRight()` first calls the reducer function with the beginning value and
844
- the last element in the array. The result becomes the new accumulator value,
845
- which is passed in to the reducer function along with the next-to-last element
846
- in the array. `reduceRight()` proceeds from right to left through the array,
847
- passing in the result of each stage as the accumulator to the reducer function.
848
-
849
- When all array elements are processed, the final value of the accumulator
850
- becomes the return value of `reduceRight()`. See
851
- [`Array.reduceRight`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight)
852
- on MDN.
853
-
854
- **NOTE:** In many cases, `reduce()` and `reduceRight()` give the same result. However, see the last example here and compare it to the example from `reduce()`, where order makes a difference.
855
-
856
- ```res example
857
- let sumOfSquares = (accumulator, item) => accumulator + item * item
858
-
859
- Js.Array.reduceRight(sumOfSquares, 0, [10, 2, 4]) == 120
860
- Js.Array.reduceRight((acc, item) => item /. acc, 1.0, [2.0, 4.0]) == 0.5 // 2.0 / (4.0 / 1.0)
861
- ```
862
- *)
863
-
864
- external reduceRighti : (('b -> 'a -> int -> 'b)[@bs.uncurry]) -> 'b -> 'b
865
- = "reduceRight"
866
- [@@bs.send.pipe: 'a t as 'this]
867
- (**
868
- The `reduceRighti()` function takes three parameters: a *reducer function*, a
869
- beginning accumulator value, and an array. The reducer function has three
870
- parameters: an accumulated value, an element of the array, and the index of
871
- that element. `reduceRighti()` first calls the reducer function with the
872
- beginning value, the last element in the array, and its index (length of array
873
- minus one). The result becomes the new accumulator value, which is passed in to
874
- the reducer function along with the second element in the array and one (its
875
- index). `reduceRighti()` proceeds from right to left through the array, passing
876
- in the result of each stage as the accumulator to the reducer function.
877
-
878
- When all array elements are processed, the final value of the accumulator
879
- becomes the return value of `reduceRighti()`. See
880
- [`Array.reduceRight`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight)
881
- on MDN.
882
-
883
- **NOTE:** In many cases, `reducei()` and `reduceRighti()` give the same result.
884
- However, there are cases where the order in which items are processed makes a
885
- difference.
886
-
887
- ```res example
888
- // find sum of even-index elements in array
889
- let sumOfEvens = (accumulator, item, index) =>
890
- if mod(index, 2) == 0 {
891
- accumulator + item
892
- } else {
893
- accumulator
894
- }
895
-
896
- Js.Array.reduceRighti(sumOfEvens, 0, [2, 5, 1, 4, 3]) == 6
897
- ```
898
- *)
899
-
900
- external some : (('a -> bool)[@bs.uncurry]) -> bool = "some"
901
- [@@bs.send.pipe: 'a t as 'this]
902
- (**
903
- Returns `true` if the predicate function given as the first argument to
904
- `some()` returns `true` for any element in the array; `false` otherwise.
905
-
906
- ```res example
907
- let isEven = x => mod(x, 2) == 0
908
-
909
- Js.Array.some(isEven, [3, 7, 5, 2, 9]) == true
910
- Js.Array.some(isEven, [3, 7, 5, 1, 9]) == false
911
- ```
912
- *)
913
-
914
- external somei : (('a -> int -> bool)[@bs.uncurry]) -> bool = "some"
915
- [@@bs.send.pipe: 'a t as 'this]
916
- (**
917
- Returns `true` if the predicate function given as the first argument to
918
- `somei()` returns `true` for any element in the array; `false` otherwise. The
919
- predicate function has two arguments: an item from the array and the index
920
- value
921
-
922
- ```res example
923
- // Does any string in the array
924
- // have the same length as its index?
925
-
926
- let sameLength = (str, index) => Js.String.length(str) == index
927
-
928
- // "ef" has length 2 and is it at index 2
929
- Js.Array.somei(sameLength, ["ab", "cd", "ef", "gh"]) == true
930
- // no item has the same length as its index
931
- Js.Array.somei(sameLength, ["a", "bc", "def", "gh"]) == false
932
- ```
933
- *)
934
-
935
- (* commented out until bs has a plan for iterators
936
- external values : 'a array_iter = "" [@@bs.send.pipe: 'a t as 'this] (* ES2015 *)
937
- *)
938
- external unsafe_get : 'a array -> int -> 'a = "%array_unsafe_get"
939
- (**
940
- Returns the value at the given position in the array if the position is in
941
- bounds; returns the JavaScript value `undefined` otherwise.
942
-
943
- ```res example
944
- let arr = [100, 101, 102, 103]
945
- Js.Array.unsafe_get(arr, 3) == 103
946
- Js.Array.unsafe_get(arr, 4) // returns undefined
947
- ```
948
- *)
949
-
950
- external unsafe_set : 'a array -> int -> 'a -> unit = "%array_unsafe_set"
951
- (**
952
- Sets the value at the given position in the array if the position is in bounds.
953
- If the index is out of bounds, well, “here there be dragons.“ *This function
954
- modifies the original array.*
955
-
956
- ```res example
957
- let arr = [100, 101, 102, 103]
958
- Js.Array.unsafe_set(arr, 3, 99)
959
- // result is [100, 101, 102, 99]
960
-
961
- Js.Array.unsafe_set(arr, 4, 88)
962
- // result is [100, 101, 102, 99, 88]
963
-
964
- Js.Array.unsafe_set(arr, 6, 77)
965
- // result is [100, 101, 102, 99, 88, <1 empty item>, 77]
966
-
967
- Js.Array.unsafe_set(arr, -1, 66)
968
- // you don't want to know.
969
- ```
970
- *)