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