You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use idiomatic new JS array immutable helpers (#139)
* Use idiomatic new JS array immutable helpers
Fixes#138
Added `toSorted`, `toReversed`, `toSpliced` and `with`, per spec.
Which means moving `sortInPlace` to `sort`. Same for `reverseInPlace` -> `reverse` and `spliceInPlace` -> `splice`.
This is a small breaking change, thankfully caught by the type system, and by Core typing these mutable helpers' return as `unit`.
Did the same for `TypedArray`. Though its `reverse` and `sort` _did_ return the array itself, so this breaking change should be carefuly advertized.
The `toBla-ed` naming convention seems to be the way to go in JS in the future. We should consider that for us as well. Otherwise we'd end up diverging more and more when JS releases more immutable helpers.
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -109,7 +109,7 @@ This standard library is based on `rescript-js`, but with the tweaks and modific
109
109
-`findIndexOpt`/`lastIndexOf`/`indexOfOpt` are added, returning `None` instead of `-1` if the item searched for does not exist. These are in addition to `findIndex`/`lastIndexOf`, which still returns `-1` when the item you're looking for does not exist.
110
110
-`getUnsafe` added (copied from `Belt`).
111
111
-`setUnsafe` added (copied from `Belt`).
112
-
-`reverse` added (copied from `Belt`), in addition to existing `reverseInPlace`. `reverseInPlace` is zero cost but does not produce a new array. `reverse` does produce a new array.
112
+
-`sort`, `toSorted`, `reverse`, `toReversed`, `splice`, `toSpliced` are the same as their JS counterpart (mutable and immutable, respectively).
113
113
-`keepMap` is added from `Belt`, but **renamed to `filterMap`**. Rationale: `filterMap` is closer to the JS convention of naming. It's also available in other languages like Rust. `keep` et al can confuse beginners, who're bound to be looking for `filter` style names since that's what JS has.
114
114
-`shuffle` and `shuffleInPlace` are added (copied from `Belt`).
115
115
-`flatMap` added (copied from `Belt`, but using native `map` and `concat` functions).
0 commit comments