Skip to content

Commit 8fb2a5b

Browse files
committed
Add documentation
1 parent 5735137 commit 8fb2a5b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

runtime/Stdlib_Array.resi

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,23 @@ external splice: (array<'a>, ~start: int, ~remove: int, ~insert: array<'a>) => u
302302
external toSpliced: (array<'a>, ~start: int, ~remove: int, ~insert: array<'a>) => array<'a> =
303303
"toSpliced"
304304

305+
/**
306+
`removeInPlace(array, index)` removes the item at the specified `index` from `array`.
307+
308+
Beware this will *mutate* the array.
309+
310+
## Examples
311+
312+
```rescript
313+
let array = []
314+
array->Array.removeInPlace(0)
315+
assertEqual(array, []) // Removing from an empty array does nothing
316+
317+
let array2 = ["Hello", "Hi", "Good bye"]
318+
array2->Array.removeInPlace(1)
319+
assertEqual(array2, ["Hello", "Good bye"]) // Removes the item at index 1
320+
```
321+
*/
305322
@send
306323
external removeInPlace: (array<'a>, int, @as(1) _) => unit = "splice"
307324

0 commit comments

Comments
 (0)