Skip to content

Commit a71ea16

Browse files
authored
String2, Array2, Promise2 -> Core (#771)
1 parent abe6e50 commit a71ea16

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

pages/docs/manual/latest/array-and-list.mdx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ ReScript arrays' items must have the same type, i.e. homogeneous.
2525

2626
### Usage
2727

28-
See the [Js.Array](api/js/array) API.
29-
3028
Access & update an array item like so:
3129

3230
<CodeTab labels={["ReScript", "JS Output"]}>
@@ -38,7 +36,7 @@ let firstItem = myArray[0] // "hello"
3836
3937
myArray[0] = "hey" // now ["hey", "world", "how are you"]
4038
41-
let pushedValue = Js.Array2.push(myArray, "bye")
39+
myArray->Array.push("bye")
4240
```
4341
```js
4442
var myArray = ["hello", "world", "how are you"];

pages/docs/manual/latest/async-await.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ This can be done by wrapping your `await` calls in a new `{}` closure.
180180
@val external fetchUserMail: string => promise<string> = "GlobalAPI.fetchUserMail"
181181
182182
let fetchData = async () => {
183-
let mail = {await fetchUserMail("1234")}->Js.String2.toUpperCase
183+
let mail = {await fetchUserMail("1234")}->String.toUpperCase
184184
Console.log(`All upper-cased mail: ${mail}`)
185185
}
186186
```
@@ -242,13 +242,13 @@ async function fetchData(param) {
242242

243243
## `await` multiple promises
244244

245-
We can utilize the `Js.Promise2` module to handle multiple promises. E.g. let's use `Js.Promise2.all` to wait for multiple promises before continuing the program:
245+
We can utilize the `Promise` module to handle multiple promises. E.g. let's use `Promise.all` to wait for multiple promises before continuing the program:
246246

247247
```res
248248
let pauseReturn = (value, timeout) => {
249-
Js.Promise2.make((~resolve, ~reject) => {
249+
Promise.make((resolve, _reject) => {
250250
Js.Global.setTimeout(() => {
251-
resolve(. value)
251+
resolve(value)
252252
}, timeout)->ignore
253253
})
254254
}
@@ -258,7 +258,7 @@ let logMultipleValues = async () => {
258258
let promise2 = pauseReturn("value2", 1200)
259259
let promise3 = pauseReturn("value3", 500)
260260
261-
let all = await Js.Promise2.all([promise1, promise2, promise3])
261+
let all = await Promise.all([promise1, promise2, promise3])
262262
263263
switch all {
264264
| [v1, v2, v3] => Console.log(`All values: ${v1}, ${v2}, ${v3}`)

pages/docs/manual/latest/promise.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ external fetchMessage: string => promise<string> = "global.fetchMessage"
9393
let logAsyncMessage = async () => {
9494
let messages = await Js.Promise2.all([fetchMessage("message1"), fetchMessage("message2")])
9595
96-
Console.log(Js.Array2.joinWith(messages, ", "))
96+
Console.log(messages->Array.joinWith(", "))
9797
}
9898
```
9999

0 commit comments

Comments
 (0)