@@ -55,28 +55,28 @@ let y = "abc"
55
55
<: y.to_num()
56
56
```
57
57
58
- ### @(_ v_ : str).to_arr(): ` arr< str> `
58
+ ### @(_ v_ : str).to_arr(): arr& lt ; str& gt ;
59
59
Splits the string into an array of grapheme clusters.
60
60
If the string contains no isolated surrogates, they are not returned.
61
61
62
- ### @(_ v_ : str).to_unicode_arr(): ` arr< str> `
62
+ ### @(_ v_ : str).to_unicode_arr(): arr& lt ; str& gt ;
63
63
Splits the string into an array of Unicode code points.
64
64
Grapheme clusters are divided.
65
65
If the string contains no isolated surrogates, they are not returned.
66
66
67
- ### @(_ v_ : str).to_unicode_codepoint_arr(): ` arr< num> `
67
+ ### @(_ v_ : str).to_unicode_codepoint_arr(): arr& lt ; num& gt ;
68
68
Splits the string into Unicode code points and returns their numeric values as an array.
69
69
If the string contains no isolated surrogates, they are not returned.
70
70
71
- ### @(_ v_ : str).to_char_arr(): ` arr< str> `
71
+ ### @(_ v_ : str).to_char_arr(): arr& lt ; str& gt ;
72
72
Splits the string into an array of UTF-16 code units.
73
73
If the string contains surrogate pairs, both the high and low surrogates are returned separately.
74
74
75
- ### @(_ v_ : str).to_charcode_arr(): ` arr< num> `
75
+ ### @(_ v_ : str).to_charcode_arr(): arr& lt ; num& gt ;
76
76
Splits the string into UTF-16 code units and returns their numeric values as an array.
77
77
If the string contains surrogate pairs, both the high and low surrogates are returned separately.
78
78
79
- ### @(_ v_ : str).to_utf8_byte_arr(): ` arr< num> `
79
+ ### @(_ v_ : str).to_utf8_byte_arr(): arr& lt ; num& gt ;
80
80
Encodes the string into UTF-8 and returns an array of byte values (0–255).
81
81
82
82
### @(_ v_ : str).pick(_ i_ : num): str | null
@@ -127,7 +127,7 @@ let x = "Hello World!"
127
127
<: x.slice(6, 11)
128
128
```
129
129
130
- ### @(_ v_ : str).split(_ splitter_ ?: str): ` arr< str> `
130
+ ### @(_ v_ : str).split(_ splitter_ ?: str): arr& lt ; str& gt ;
131
131
Splits the string into an array based on the delimiter _ splitter_ . If _ splitter_ is omitted, splits the string into individual characters.
132
132
``` aiscript playground
133
133
let x = "Hey, how are you?"
@@ -152,7 +152,7 @@ let x = [1, 2, 3, 4, 5]
152
152
<: x.len
153
153
```
154
154
155
- ### @(_ v_ : arr).at(_ index_ : num, _ otherwise_ ?: value ): value
155
+ ### @(_ v_ : arr& lt ; T & gt ; ).at(_ index_ : num, _ otherwise_ ?: T ): T | null
156
156
Returns the element at the position _ index_ in the array.\
157
157
If _ index_ is negative, it counts from the end.\
158
158
If _ index_ is out of range, it returns _ otherwise_ instead.\
@@ -167,7 +167,7 @@ let x = [1, 2, 3, 4, 5]
167
167
<: x.at(5, "Not Found")
168
168
```
169
169
170
- ### @(_ v_ : arr).push(_ i_ : value ): null
170
+ ### @(_ v_ : arr& lt ; T & gt ; ).push(_ i_ : T ): null
171
171
** 【This operation mutates the array】**
172
172
Adds an element to the end of the array.
173
173
@@ -178,7 +178,7 @@ x.push(8)
178
178
<: x
179
179
```
180
180
181
- ### @(_ v_ : arr).unshift(i: value ): null
181
+ ### @(_ v_ : arr& lt ; T & gt ; ).unshift(i: T ): null
182
182
** 【This operation mutates the array】**
183
183
Adds an element to the beginning of the array.
184
184
@@ -189,7 +189,7 @@ x.unshift(7)
189
189
<: x
190
190
```
191
191
192
- ### @(_ v_ : arr).pop(): value
192
+ ### @(_ v_ : arr& lt ; T & gt ; ).pop(): T | null
193
193
** 【This operation mutates the array】**
194
194
Removes and returns the last element of the array.
195
195
@@ -201,7 +201,7 @@ let popped = x.pop()
201
201
<: x
202
202
```
203
203
204
- ### @(_ v_ : arr).shift(): value
204
+ ### @(_ v_ : arr& lt ; T & gt ; ).shift(): T | null
205
205
** 【This operation mutates the array】**
206
206
Removes and returns the first element of the array.
207
207
@@ -213,7 +213,7 @@ let shifted = x.shift()
213
213
<: x
214
214
```
215
215
216
- ### @(_ a_ : arr).concat(_ b_ : arr): arr
216
+ ### @(_ a_ : arr& lt ; T & gt ; ).concat(_ b_ : arr& lt ; T & gt ; ): arr& lt ; T & gt ;
217
217
Concatenates two arrays.
218
218
219
219
``` aiscript playground
@@ -239,7 +239,7 @@ let x = ["Hello", "World", "!"]
239
239
<: x.join()
240
240
```
241
241
242
- ### @(_ v_ : arr).slice(_ begin_ : num, _ end_ : num): arr
242
+ ### @(_ v_ : arr& lt ; T & gt ; ).slice(_ begin_ : num, _ end_ : num): arr& lt ; T & gt ;
243
243
Extracts a section of the array from _ begin_ to _ end_ .
244
244
245
245
``` aiscript playground
@@ -248,7 +248,7 @@ let x = [1, 2, 3, 4, 5]
248
248
<: x.slice(1, 4)
249
249
```
250
250
251
- ### @(_ v_ : arr).incl(_ i_ : value ): bool
251
+ ### @(_ v_ : arr& lt ; T & gt ; ).incl(_ i_ : T ): bool
252
252
Returns whether the specified value is present in the array.
253
253
254
254
``` aiscript playground
@@ -258,7 +258,7 @@ let x = [1, 2, 3, 4, 5]
258
258
<: x.incl(6)
259
259
```
260
260
261
- ### @(_ v_ : arr).map(_ func_ : fn): arr
261
+ ### @(_ v_ : arr& lt ; T & gt ; ).map(_ func_ : @(T, num) = & gt ; U): arr & lt ; U & gt ;
262
262
Asynchronously calls _ func_ on each element of the array.\
263
263
Returns a new array with elements replaced by the results of _ func_ .
264
264
@@ -270,7 +270,7 @@ let x = ['Tanaka', 'Suzuki', 'Yamamoto']
270
270
})
271
271
```
272
272
273
- ### @(_ v_ : arr).filter(_ func_ : fn): arr
273
+ ### @(_ v_ : arr& lt ; T & gt ; ).filter(_ func_ : @(T, num) = & gt ; bool): arr & lt ; T & gt ;
274
274
Extracts elements from the array where _ func_ returns true.\
275
275
The order is preserved.
276
276
@@ -283,8 +283,8 @@ let x = [1, 2, 3, 4, 5]
283
283
})
284
284
```
285
285
286
- ### @(_ v_ : arr).reduce(_ func_ : Callback, _ initial_ : value ): value
287
- ` Callback ` : @(_ acm_ : value , _ item_ : value , _ index_ : num): value
286
+ ### @(_ v_ : arr& lt ; T & gt ; ).reduce& lt ; U & gt ; (_ func_ : Callback, _ initial_ : U ): U
287
+ ` Callback ` : @(_ acm_ : U , _ item_ : T , _ index_ : num): U
288
288
Calls _ func_ for each element of the array in turn.
289
289
In each call, the previous result is passed as the first argument _ acm_ .
290
290
If _ initial_ is specified, the argument of the first call is (_ initial_ , _ v_ \[ 0] , 0),
@@ -300,7 +300,7 @@ let x = [1, 2, 3, 4, 5]
300
300
}, 0)
301
301
```
302
302
303
- ### @(_ v_ : arr).find(_ func_ : @(_ item_ : value , _ index_ : num) { bool } ): value
303
+ ### @(_ v_ : arr& lt ; T & gt ; ).find(_ func_ : @(_ item_ : T , _ index_ : num) = & gt ; bool ): T | null
304
304
Find the first element in the array such that _ func_ returns true and returns their values.
305
305
306
306
``` aiscript playground
@@ -312,7 +312,7 @@ let x = [1, 2, 3, 4, 5]
312
312
})
313
313
```
314
314
315
- ### @(_ v_ : arr).index_of(_ val_ : value , _ fromIndex_ ?: num): num
315
+ ### @(_ v_ : arr& lt ; T & gt ; ).index_of(_ val_ : T , _ fromIndex_ ?: num): num
316
316
Searches the array for a value equal to _ val_ and returns its index.
317
317
If _ fromIndex_ is specified, the search starts at that position.
318
318
If _ fromIndex_ is negative, the position from the end (array length + _ fromIndex_ ) is used.
@@ -336,7 +336,7 @@ x.reverse()
336
336
<: x
337
337
```
338
338
339
- ### @(_ v_ : arr).copy(): arr
339
+ ### @(_ v_ : arr& lt ; T & gt ; ).copy(): arr& lt ; T & gt ;
340
340
Generates a copy of the array.
341
341
It is a shallow copy, and array and object references are preserved.
342
342
@@ -353,7 +353,7 @@ xCopy.push(6)
353
353
<: xCopy
354
354
```
355
355
356
- ### @(_ v_ : arr).sort(_ comp_ : @(_ a_ : value , _ b_ : value) ): arr
356
+ ### @(_ v_ : arr& lt ; T & gt ; ).sort(_ comp_ : @(_ a_ : T , _ b_ : T) => num ): arr& lt ; T & gt ;
357
357
** 【This operation mutates the array】**
358
358
Sort an array. Pass the following comparison function as the first argument _ comp_ .
359
359
This operation is stable sort.
@@ -380,7 +380,7 @@ x.sort(@(a, b) {
380
380
<: x
381
381
```
382
382
383
- ### @(_ v_ : arr).fill(_ val_ ?: value , _ fromIndex_ ?: num, _ toIndex_ ?: num): arr
383
+ ### @(_ v_ : arr& lt ; T & gt ; ).fill(_ val_ ?: T , _ fromIndex_ ?: num, _ toIndex_ ?: num): arr& lt ; T & gt ;
384
384
** 【This operation mutates the array】**
385
385
Replaces elements in the range _ fromIndex_ to _ toIndex_ of the array with _ val_ .
386
386
If _ val_ is omitted, it is replaced with ` null ` .
@@ -395,7 +395,7 @@ x.fill(0, 1, 4)
395
395
<: x
396
396
```
397
397
398
- ### @(_ v_ : arr).repeat(_ times_ : num): arr
398
+ ### @(_ v_ : arr& lt ; T & gt ; ).repeat(_ times_ : num): arr& lt ; T & gt ;
399
399
Creates an array repeated _ times_ times.
400
400
Like ` arr.copy ` , it is a shallow copy, and array and object references are preserved.
401
401
_ times_ must be an integer value greater than or equal to 0. Otherwise, throws error.
@@ -406,7 +406,7 @@ let x = [1, 2, 3]
406
406
<: x.repeat(3)
407
407
```
408
408
409
- ### @(_ v_ : arr).splice(_ index_ : num, _ remove_count_ ?: num, _ items_ ?: arr\ & lt;value > ; ): arr\ & lt;value > ;
409
+ ### @(_ v_ : arr& lt ; T & gt ; ).splice(_ index_ : num, _ remove_count_ ?: num, _ items_ ?: arr< ; T > ; ): arr< ; T > ;
410
410
** 【This operation mutates the array】**
411
411
Removes _ remove_count_ elements from the _ index_ array and inserts _ items_ elements in their place.
412
412
Returns an array of the elements removed as the return value.
@@ -436,7 +436,7 @@ let x = [1, [2, 3], [4, [5, 6]]]
436
436
<: x.flat(2)
437
437
```
438
438
439
- ### @(_ v_ : arr).flat_map(_ func_ : @(_ item_ : value , _ index_ : num) { value } ): arr
439
+ ### @(_ v_ : arr& lt ; T & gt ; ).flat_map& lt ; U & gt ; (_ func_ : @(_ item_ : T , _ index_ : num) = & gt ; arr & lt ; U & gt ; | U ): arr& lt ; U & gt ;
440
440
After replacing each element of the array with the return value of _ func_ , a new array is created, flattened by one level.
441
441
_ func_ is called asynchronously.
442
442
@@ -448,7 +448,7 @@ let x = [1, 2, 3]
448
448
})
449
449
```
450
450
451
- ### @(_ v_ : arr).insert(_ index_ : num, _ item_ : value ): null
451
+ ### @(_ v_ : arr& lt ; T & gt ; ).insert(_ index_ : num, _ item_ : T ): null
452
452
** 【This operation mutates the array】**
453
453
Inserts _ item_ at the _ index_ position in the array.
454
454
If _ index_ is negative, count from the end.
@@ -463,7 +463,7 @@ x.insert(2, 6)
463
463
<: x
464
464
```
465
465
466
- ### @(_ v_ : arr).remove(_ index_ : num): value | null
466
+ ### @(_ v_ : arr& lt ; T & gt ; ).remove(_ index_ : num): T | null
467
467
** 【This operation mutates the array】**
468
468
Removes the element at position _ index_ from the array and returns that element.
469
469
If _ index_ is negative, count from the end.
@@ -479,7 +479,7 @@ let removed = x.remove(2)
479
479
<: x
480
480
```
481
481
482
- ### @(_ v_ : arr).every(_ func_ : @(_ item_ : value , _ index_ : num) { bool } ): bool
482
+ ### @(_ v_ : arr& lt ; T & gt ; ).every(_ func_ : @(_ item_ : T , _ index_ : num) = & gt ; bool ): bool
483
483
Returns true only if _ func_ returns true for all elements of the array. Always returns true for an empty array.
484
484
485
485
``` aiscript playground
@@ -498,7 +498,7 @@ let y = [2, 4, 6, 7, 8]
498
498
<: judgeAllEven(y)
499
499
```
500
500
501
- ### @(_ v_ : arr).some(_ func_ : @(_ item_ : value , _ index_ : num) { bool } ): bool
501
+ ### @(_ v_ : arr& lt ; T & gt ; ).some(_ func_ : @(_ item_ : T , _ index_ : num) = & gt ; bool): bool
502
502
Returns true only when there is an element for which _ func_ returns true for an array element.
503
503
504
504
``` aiscript playground
0 commit comments