@stdlib/array-uint8c 0.0.8 → 0.1.0
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.
- package/CITATION.cff +30 -0
- package/LICENSE +0 -304
- package/NOTICE +1 -1
- package/README.md +31 -19
- package/dist/index.d.ts +3 -0
- package/{docs/types/test.ts → dist/index.js} +4 -22
- package/dist/index.js.map +7 -0
- package/docs/types/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/package.json +17 -17
- package/docs/repl.txt +0 -953
- /package/lib/{uint8clampedarray.js → main.js} +0 -0
package/docs/repl.txt
DELETED
|
@@ -1,953 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
{{alias}}()
|
|
3
|
-
A typed array constructor which returns a typed array representing an array
|
|
4
|
-
of 8-bit unsigned integers in the platform byte order clamped to 0-255.
|
|
5
|
-
|
|
6
|
-
Returns
|
|
7
|
-
-------
|
|
8
|
-
out: Uint8ClampedArray
|
|
9
|
-
A typed array.
|
|
10
|
-
|
|
11
|
-
Examples
|
|
12
|
-
--------
|
|
13
|
-
> var arr = new {{alias}}()
|
|
14
|
-
<Uint8ClampedArray>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
{{alias}}( length )
|
|
18
|
-
Returns a typed array having a specified length.
|
|
19
|
-
|
|
20
|
-
Parameters
|
|
21
|
-
----------
|
|
22
|
-
length: integer
|
|
23
|
-
Typed array length.
|
|
24
|
-
|
|
25
|
-
Returns
|
|
26
|
-
-------
|
|
27
|
-
out: Uint8ClampedArray
|
|
28
|
-
A typed array.
|
|
29
|
-
|
|
30
|
-
Examples
|
|
31
|
-
--------
|
|
32
|
-
> var arr = new {{alias}}( 5 )
|
|
33
|
-
<Uint8ClampedArray>[ 0, 0, 0, 0, 0 ]
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
{{alias}}( typedarray )
|
|
37
|
-
Creates a typed array from another typed array.
|
|
38
|
-
|
|
39
|
-
Parameters
|
|
40
|
-
----------
|
|
41
|
-
typedarray: TypedArray
|
|
42
|
-
Typed array from which to generate another typed array.
|
|
43
|
-
|
|
44
|
-
Returns
|
|
45
|
-
-------
|
|
46
|
-
out: Uint8ClampedArray
|
|
47
|
-
A typed array.
|
|
48
|
-
|
|
49
|
-
Examples
|
|
50
|
-
--------
|
|
51
|
-
> var arr1 = new {{alias:@stdlib/array/int32}}( [ 5, 5, 5 ] );
|
|
52
|
-
> var arr2 = new {{alias}}( arr1 )
|
|
53
|
-
<Uint8ClampedArray>[ 5, 5, 5 ]
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
{{alias}}( obj )
|
|
57
|
-
Creates a typed array from an array-like object or iterable.
|
|
58
|
-
|
|
59
|
-
Parameters
|
|
60
|
-
----------
|
|
61
|
-
obj: Object
|
|
62
|
-
Array-like object or iterable from which to generate a typed array.
|
|
63
|
-
|
|
64
|
-
Returns
|
|
65
|
-
-------
|
|
66
|
-
out: Uint8ClampedArray
|
|
67
|
-
A typed array.
|
|
68
|
-
|
|
69
|
-
Examples
|
|
70
|
-
--------
|
|
71
|
-
> var arr1 = [ 5.0, 5.0, 5.0 ];
|
|
72
|
-
> var arr2 = new {{alias}}( arr1 )
|
|
73
|
-
<Uint8ClampedArray>[ 5, 5, 5 ]
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
{{alias}}( buffer[, byteOffset[, length]] )
|
|
77
|
-
Returns a typed array view of an ArrayBuffer.
|
|
78
|
-
|
|
79
|
-
Parameters
|
|
80
|
-
----------
|
|
81
|
-
buffer: ArrayBuffer
|
|
82
|
-
Underlying ArrayBuffer.
|
|
83
|
-
|
|
84
|
-
byteOffset: integer (optional)
|
|
85
|
-
Integer byte offset specifying the location of the first typed array
|
|
86
|
-
element. Default: 0.
|
|
87
|
-
|
|
88
|
-
length: integer (optional)
|
|
89
|
-
View length. If not provided, the view spans from the byteOffset to
|
|
90
|
-
the end of the underlying ArrayBuffer.
|
|
91
|
-
|
|
92
|
-
Returns
|
|
93
|
-
-------
|
|
94
|
-
out: Uint8ClampedArray
|
|
95
|
-
A typed array.
|
|
96
|
-
|
|
97
|
-
Examples
|
|
98
|
-
--------
|
|
99
|
-
> var buf = new {{alias:@stdlib/array/buffer}}( 4 );
|
|
100
|
-
> var arr = new {{alias}}( buf, 0, 4 )
|
|
101
|
-
<Uint8ClampedArray>[ 0, 0, 0, 0 ]
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
{{alias}}.from( src[, map[, thisArg]] )
|
|
105
|
-
Creates a new typed array from an array-like object or an iterable.
|
|
106
|
-
|
|
107
|
-
A callback is provided the following arguments:
|
|
108
|
-
|
|
109
|
-
- value: source value.
|
|
110
|
-
- index: source index.
|
|
111
|
-
|
|
112
|
-
Parameters
|
|
113
|
-
----------
|
|
114
|
-
src: ArrayLike|Iterable
|
|
115
|
-
Source of array elements.
|
|
116
|
-
|
|
117
|
-
map: Function (optional)
|
|
118
|
-
Callback to invoke for each source element.
|
|
119
|
-
|
|
120
|
-
thisArg: Any (optional)
|
|
121
|
-
Callback execution context.
|
|
122
|
-
|
|
123
|
-
Returns
|
|
124
|
-
-------
|
|
125
|
-
out: Uint8ClampedArray
|
|
126
|
-
A typed array.
|
|
127
|
-
|
|
128
|
-
Examples
|
|
129
|
-
--------
|
|
130
|
-
> function mapFcn( v ) { return v * 2; };
|
|
131
|
-
> var arr = {{alias}}.from( [ 1, 2 ], mapFcn )
|
|
132
|
-
<Uint8ClampedArray>[ 2, 4 ]
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
{{alias}}.of( element0[, element1[, ...elementN]] )
|
|
136
|
-
Creates a new typed array from a variable number of arguments.
|
|
137
|
-
|
|
138
|
-
Parameters
|
|
139
|
-
----------
|
|
140
|
-
element0: number
|
|
141
|
-
Array element.
|
|
142
|
-
|
|
143
|
-
element1: number (optional)
|
|
144
|
-
Array element.
|
|
145
|
-
|
|
146
|
-
elementN: number (optional)
|
|
147
|
-
Array elements.
|
|
148
|
-
|
|
149
|
-
Returns
|
|
150
|
-
-------
|
|
151
|
-
out: Uint8ClampedArray
|
|
152
|
-
A typed array.
|
|
153
|
-
|
|
154
|
-
Examples
|
|
155
|
-
--------
|
|
156
|
-
> var arr = {{alias}}.of( 1, 2 )
|
|
157
|
-
<Uint8ClampedArray>[ 1, 2 ]
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
{{alias}}.BYTES_PER_ELEMENT
|
|
161
|
-
Number of bytes per view element.
|
|
162
|
-
|
|
163
|
-
Examples
|
|
164
|
-
--------
|
|
165
|
-
> {{alias}}.BYTES_PER_ELEMENT
|
|
166
|
-
1
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
{{alias}}.name
|
|
170
|
-
Typed array constructor name.
|
|
171
|
-
|
|
172
|
-
Examples
|
|
173
|
-
--------
|
|
174
|
-
> {{alias}}.name
|
|
175
|
-
'Uint8ClampedArray'
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
{{alias}}.prototype.buffer
|
|
179
|
-
Read-only property which returns the ArrayBuffer referenced by the typed
|
|
180
|
-
array.
|
|
181
|
-
|
|
182
|
-
Examples
|
|
183
|
-
--------
|
|
184
|
-
> var arr = new {{alias}}( 5 );
|
|
185
|
-
> arr.buffer
|
|
186
|
-
<ArrayBuffer>
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
{{alias}}.prototype.byteLength
|
|
190
|
-
Read-only property which returns the length (in bytes) of the typed array.
|
|
191
|
-
|
|
192
|
-
Examples
|
|
193
|
-
--------
|
|
194
|
-
> var arr = new {{alias}}( 5 );
|
|
195
|
-
> arr.byteLength
|
|
196
|
-
5
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
{{alias}}.prototype.byteOffset
|
|
200
|
-
Read-only property which returns the offset (in bytes) of the typed array
|
|
201
|
-
from the start of its ArrayBuffer.
|
|
202
|
-
|
|
203
|
-
Examples
|
|
204
|
-
--------
|
|
205
|
-
> var arr = new {{alias}}( 5 );
|
|
206
|
-
> arr.byteOffset
|
|
207
|
-
0
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
{{alias}}.prototype.BYTES_PER_ELEMENT
|
|
211
|
-
Number of bytes per view element.
|
|
212
|
-
|
|
213
|
-
Examples
|
|
214
|
-
--------
|
|
215
|
-
> var arr = new {{alias}}( 5 );
|
|
216
|
-
> arr.BYTES_PER_ELEMENT
|
|
217
|
-
1
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
{{alias}}.prototype.length
|
|
221
|
-
Read-only property which returns the number of view elements.
|
|
222
|
-
|
|
223
|
-
Examples
|
|
224
|
-
--------
|
|
225
|
-
> var arr = new {{alias}}( 5 );
|
|
226
|
-
> arr.length
|
|
227
|
-
5
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
{{alias}}.prototype.copyWithin( target, start[, end] )
|
|
231
|
-
Copies a sequence of elements within the array starting at `start` and
|
|
232
|
-
ending at `end` (non-inclusive) to the position starting at `target`.
|
|
233
|
-
|
|
234
|
-
Parameters
|
|
235
|
-
----------
|
|
236
|
-
target: integer
|
|
237
|
-
Target start index position.
|
|
238
|
-
|
|
239
|
-
start: integer
|
|
240
|
-
Source start index position.
|
|
241
|
-
|
|
242
|
-
end: integer (optional)
|
|
243
|
-
Source end index position. Default: out.length.
|
|
244
|
-
|
|
245
|
-
Returns
|
|
246
|
-
-------
|
|
247
|
-
out: Uint8ClampedArray
|
|
248
|
-
Modified array.
|
|
249
|
-
|
|
250
|
-
Examples
|
|
251
|
-
--------
|
|
252
|
-
> var arr = new {{alias}}( [ 1, 2, 3, 4, 5 ] );
|
|
253
|
-
> arr.copyWithin( 3, 0, 2 );
|
|
254
|
-
> arr[ 3 ]
|
|
255
|
-
1
|
|
256
|
-
> arr[ 4 ]
|
|
257
|
-
2
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
{{alias}}.prototype.entries()
|
|
261
|
-
Returns an iterator for iterating over array key-value pairs.
|
|
262
|
-
|
|
263
|
-
Returns
|
|
264
|
-
-------
|
|
265
|
-
iter: Iterator
|
|
266
|
-
Iterator for iterating over array key-value pairs.
|
|
267
|
-
|
|
268
|
-
Examples
|
|
269
|
-
--------
|
|
270
|
-
> var arr = new {{alias}}( [ 1, 2 ] );
|
|
271
|
-
> it = arr.entries();
|
|
272
|
-
> it.next().value
|
|
273
|
-
[ 0, 1 ]
|
|
274
|
-
> it.next().value
|
|
275
|
-
[ 1, 2 ]
|
|
276
|
-
> it.next().done
|
|
277
|
-
true
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
{{alias}}.prototype.every( predicate[, thisArg] )
|
|
281
|
-
Tests whether all array elements pass a test implemented by a predicate
|
|
282
|
-
function.
|
|
283
|
-
|
|
284
|
-
A predicate function is provided the following arguments:
|
|
285
|
-
|
|
286
|
-
- value: array element.
|
|
287
|
-
- index: array index.
|
|
288
|
-
- arr: array on which the method is invoked.
|
|
289
|
-
|
|
290
|
-
Parameters
|
|
291
|
-
----------
|
|
292
|
-
predicate: Function
|
|
293
|
-
Predicate function which tests array elements. If a predicate function
|
|
294
|
-
returns a truthy value, an array element passes; otherwise, an array
|
|
295
|
-
element fails.
|
|
296
|
-
|
|
297
|
-
thisArg: Any (optional)
|
|
298
|
-
Callback execution context.
|
|
299
|
-
|
|
300
|
-
Returns
|
|
301
|
-
-------
|
|
302
|
-
bool: boolean
|
|
303
|
-
Boolean indicating whether all array elements pass.
|
|
304
|
-
|
|
305
|
-
Examples
|
|
306
|
-
--------
|
|
307
|
-
> var arr = new {{alias}}( [ 1, 2 ] );
|
|
308
|
-
> function predicate( v ) { return ( v <= 1 ); };
|
|
309
|
-
> arr.every( predicate )
|
|
310
|
-
false
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
{{alias}}.prototype.fill( value[, start[, end]] )
|
|
314
|
-
Fills an array from a start index to an end index (non-inclusive) with a
|
|
315
|
-
provided value.
|
|
316
|
-
|
|
317
|
-
Parameters
|
|
318
|
-
----------
|
|
319
|
-
value: number
|
|
320
|
-
Fill value.
|
|
321
|
-
|
|
322
|
-
start: integer (optional)
|
|
323
|
-
Start index. If less than zero, the start index is resolved relative to
|
|
324
|
-
the last array element. Default: 0.
|
|
325
|
-
|
|
326
|
-
end: integer (optional)
|
|
327
|
-
End index (non-inclusive). If less than zero, the end index is resolved
|
|
328
|
-
relative to the last array element. Default: out.length.
|
|
329
|
-
|
|
330
|
-
Returns
|
|
331
|
-
-------
|
|
332
|
-
out: Uint8ClampedArray
|
|
333
|
-
Modified array.
|
|
334
|
-
|
|
335
|
-
Examples
|
|
336
|
-
--------
|
|
337
|
-
> var arr = new {{alias}}( [ 1, 2 ] );
|
|
338
|
-
> arr.fill( 3 );
|
|
339
|
-
> arr[ 0 ]
|
|
340
|
-
3
|
|
341
|
-
> arr[ 1 ]
|
|
342
|
-
3
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
{{alias}}.prototype.filter( predicate[, thisArg] )
|
|
346
|
-
Creates a new array which includes those elements for which a predicate
|
|
347
|
-
function returns a truthy value.
|
|
348
|
-
|
|
349
|
-
A predicate function is provided the following arguments:
|
|
350
|
-
|
|
351
|
-
- value: array element.
|
|
352
|
-
- index: array index.
|
|
353
|
-
- arr: array on which the method is invoked.
|
|
354
|
-
|
|
355
|
-
The returned array has the same data type as the host array.
|
|
356
|
-
|
|
357
|
-
If a predicate function does not return a truthy value for any array
|
|
358
|
-
element, the method returns `null`.
|
|
359
|
-
|
|
360
|
-
Parameters
|
|
361
|
-
----------
|
|
362
|
-
predicate: Function
|
|
363
|
-
Predicate function which filters array elements. If a predicate function
|
|
364
|
-
returns a truthy value, an array element is included in the output
|
|
365
|
-
array; otherwise, an array element is not included in the output array.
|
|
366
|
-
|
|
367
|
-
thisArg: Any (optional)
|
|
368
|
-
Callback execution context.
|
|
369
|
-
|
|
370
|
-
Returns
|
|
371
|
-
-------
|
|
372
|
-
out: Uint8ClampedArray
|
|
373
|
-
A typed array.
|
|
374
|
-
|
|
375
|
-
Examples
|
|
376
|
-
--------
|
|
377
|
-
> var arr1 = new {{alias}}( [ 1, 2, 3 ] );
|
|
378
|
-
> function predicate( v ) { return ( v > 1 ); };
|
|
379
|
-
> var arr2 = arr1.filter( predicate );
|
|
380
|
-
> arr2.length
|
|
381
|
-
2
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
{{alias}}.prototype.find( predicate[, thisArg] )
|
|
385
|
-
Returns the first array element for which a provided predicate function
|
|
386
|
-
returns a truthy value.
|
|
387
|
-
|
|
388
|
-
A predicate function is provided the following arguments:
|
|
389
|
-
|
|
390
|
-
- value: array element.
|
|
391
|
-
- index: array index.
|
|
392
|
-
- arr: array on which the method is invoked.
|
|
393
|
-
|
|
394
|
-
If a predicate function never returns a truthy value, the method returns
|
|
395
|
-
`undefined`.
|
|
396
|
-
|
|
397
|
-
Parameters
|
|
398
|
-
----------
|
|
399
|
-
predicate: Function
|
|
400
|
-
Predicate function which tests array elements.
|
|
401
|
-
|
|
402
|
-
thisArg: Any (optional)
|
|
403
|
-
Callback execution context.
|
|
404
|
-
|
|
405
|
-
Returns
|
|
406
|
-
-------
|
|
407
|
-
value: number|undefined
|
|
408
|
-
Array element.
|
|
409
|
-
|
|
410
|
-
Examples
|
|
411
|
-
--------
|
|
412
|
-
> var arr = new {{alias}}( [ 1, 2, 3 ] );
|
|
413
|
-
> function predicate( v ) { return ( v > 2 ); };
|
|
414
|
-
> var v = arr.find( predicate )
|
|
415
|
-
3
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
{{alias}}.prototype.findIndex( predicate[, thisArg] )
|
|
419
|
-
Returns the index of the first array element for which a provided predicate
|
|
420
|
-
function returns a truthy value.
|
|
421
|
-
|
|
422
|
-
A predicate function is provided the following arguments:
|
|
423
|
-
|
|
424
|
-
- value: array element.
|
|
425
|
-
- index: array index.
|
|
426
|
-
- arr: array on which the method is invoked.
|
|
427
|
-
|
|
428
|
-
If a predicate function never returns a truthy value, the method returns
|
|
429
|
-
`-1`.
|
|
430
|
-
|
|
431
|
-
Parameters
|
|
432
|
-
----------
|
|
433
|
-
predicate: Function
|
|
434
|
-
Predicate function which tests array elements.
|
|
435
|
-
|
|
436
|
-
thisArg: Any (optional)
|
|
437
|
-
Callback execution context.
|
|
438
|
-
|
|
439
|
-
Returns
|
|
440
|
-
-------
|
|
441
|
-
idx: integer
|
|
442
|
-
Array index.
|
|
443
|
-
|
|
444
|
-
Examples
|
|
445
|
-
--------
|
|
446
|
-
> var arr = new {{alias}}( [ 1, 2, 3 ] );
|
|
447
|
-
> function predicate( v ) { return ( v > 2 ); };
|
|
448
|
-
> var idx = arr.findIndex( predicate )
|
|
449
|
-
2
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
{{alias}}.prototype.forEach( fcn[, thisArg] )
|
|
453
|
-
Invokes a callback for each array element.
|
|
454
|
-
|
|
455
|
-
A provided function is provided the following arguments:
|
|
456
|
-
|
|
457
|
-
- value: array element.
|
|
458
|
-
- index: array index.
|
|
459
|
-
- arr: array on which the method is invoked.
|
|
460
|
-
|
|
461
|
-
Parameters
|
|
462
|
-
----------
|
|
463
|
-
fcn: Function
|
|
464
|
-
Function to invoke for each array element.
|
|
465
|
-
|
|
466
|
-
thisArg: Any (optional)
|
|
467
|
-
Callback execution context.
|
|
468
|
-
|
|
469
|
-
Examples
|
|
470
|
-
--------
|
|
471
|
-
> var arr = new {{alias}}( [ 3, 2, 1 ] );
|
|
472
|
-
> var str = ' ';
|
|
473
|
-
> function fcn( v, i ) { str += i + ':' + v + ' '; };
|
|
474
|
-
> arr.forEach( fcn );
|
|
475
|
-
> str
|
|
476
|
-
' 0:3 1:2 2:1 '
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
{{alias}}.prototype.includes( searchElement[, fromIndex] )
|
|
480
|
-
Returns a boolean indicating whether an array includes a search element.
|
|
481
|
-
|
|
482
|
-
Parameters
|
|
483
|
-
----------
|
|
484
|
-
searchElement: number
|
|
485
|
-
Search element.
|
|
486
|
-
|
|
487
|
-
fromIndex: integer (optional)
|
|
488
|
-
Array index from which to begin searching. If provided a negative value,
|
|
489
|
-
the method resolves the start index relative to the last array element.
|
|
490
|
-
Default: 0.
|
|
491
|
-
|
|
492
|
-
Returns
|
|
493
|
-
-------
|
|
494
|
-
bool: boolean
|
|
495
|
-
Boolean indicating whether an array includes a search element.
|
|
496
|
-
|
|
497
|
-
Examples
|
|
498
|
-
--------
|
|
499
|
-
> var arr = new {{alias}}( [ 1, 2, 3 ] );
|
|
500
|
-
> var bool = arr.includes( 4 )
|
|
501
|
-
false
|
|
502
|
-
> bool = arr.includes( 3 )
|
|
503
|
-
true
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
{{alias}}.prototype.indexOf( searchElement[, fromIndex] )
|
|
507
|
-
Returns the index of the first array element strictly equal to a search
|
|
508
|
-
element.
|
|
509
|
-
|
|
510
|
-
If unable to locate a search element, the method returns `-1`.
|
|
511
|
-
|
|
512
|
-
Parameters
|
|
513
|
-
----------
|
|
514
|
-
searchElement: number
|
|
515
|
-
Search element.
|
|
516
|
-
|
|
517
|
-
fromIndex: integer (optional)
|
|
518
|
-
Array index from which to begin searching. If provided a negative value,
|
|
519
|
-
the method resolves the start index relative to the last array element.
|
|
520
|
-
Default: 0.
|
|
521
|
-
|
|
522
|
-
Returns
|
|
523
|
-
-------
|
|
524
|
-
idx: integer
|
|
525
|
-
Array index.
|
|
526
|
-
|
|
527
|
-
Examples
|
|
528
|
-
--------
|
|
529
|
-
> var arr = new {{alias}}( [ 1, 2, 3 ] );
|
|
530
|
-
> var idx = arr.indexOf( 4 )
|
|
531
|
-
-1
|
|
532
|
-
> idx = arr.indexOf( 3 )
|
|
533
|
-
2
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
{{alias}}.prototype.join( [separator] )
|
|
537
|
-
Serializes an array by joining all array elements as a string.
|
|
538
|
-
|
|
539
|
-
Parameters
|
|
540
|
-
----------
|
|
541
|
-
separator: string (optional)
|
|
542
|
-
String delineating array elements. Default: ','.
|
|
543
|
-
|
|
544
|
-
Returns
|
|
545
|
-
-------
|
|
546
|
-
str: string
|
|
547
|
-
Array serialized as a string.
|
|
548
|
-
|
|
549
|
-
Examples
|
|
550
|
-
--------
|
|
551
|
-
> var arr = new {{alias}}( [ 1, 2, 3 ] );
|
|
552
|
-
> arr.join( '|' )
|
|
553
|
-
'1|2|3'
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
{{alias}}.prototype.keys()
|
|
557
|
-
Returns an iterator for iterating over array keys.
|
|
558
|
-
|
|
559
|
-
Returns
|
|
560
|
-
-------
|
|
561
|
-
iter: Iterator
|
|
562
|
-
Iterator for iterating over array keys.
|
|
563
|
-
|
|
564
|
-
Examples
|
|
565
|
-
--------
|
|
566
|
-
> var arr = new {{alias}}( [ 1, 2 ] );
|
|
567
|
-
> it = arr.keys();
|
|
568
|
-
> it.next().value
|
|
569
|
-
0
|
|
570
|
-
> it.next().value
|
|
571
|
-
1
|
|
572
|
-
> it.next().done
|
|
573
|
-
true
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
{{alias}}.prototype.lastIndexOf( searchElement[, fromIndex] )
|
|
577
|
-
Returns the index of the last array element strictly equal to a search
|
|
578
|
-
element.
|
|
579
|
-
|
|
580
|
-
The method iterates from the last array element to the first array element.
|
|
581
|
-
|
|
582
|
-
If unable to locate a search element, the method returns `-1`.
|
|
583
|
-
|
|
584
|
-
Parameters
|
|
585
|
-
----------
|
|
586
|
-
searchElement: number
|
|
587
|
-
Search element.
|
|
588
|
-
|
|
589
|
-
fromIndex: integer (optional)
|
|
590
|
-
Array index from which to begin searching. If provided a negative value,
|
|
591
|
-
the method resolves the start index relative to the last array element.
|
|
592
|
-
Default: -1.
|
|
593
|
-
|
|
594
|
-
Returns
|
|
595
|
-
-------
|
|
596
|
-
idx: integer
|
|
597
|
-
array index.
|
|
598
|
-
|
|
599
|
-
Examples
|
|
600
|
-
--------
|
|
601
|
-
> var arr = new {{alias}}( [ 1, 0, 2, 0, 1 ] );
|
|
602
|
-
> var idx = arr.lastIndexOf( 3 )
|
|
603
|
-
-1
|
|
604
|
-
> idx = arr.lastIndexOf( 0 )
|
|
605
|
-
3
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
{{alias}}.prototype.map( fcn[, thisArg] )
|
|
609
|
-
Maps each array element to an element in a new typed array.
|
|
610
|
-
|
|
611
|
-
A provided function is provided the following arguments:
|
|
612
|
-
|
|
613
|
-
- value: array element.
|
|
614
|
-
- index: array index.
|
|
615
|
-
- arr: array on which the method is invoked.
|
|
616
|
-
|
|
617
|
-
The returned array has the same data type as the host array.
|
|
618
|
-
|
|
619
|
-
Parameters
|
|
620
|
-
----------
|
|
621
|
-
fcn: Function
|
|
622
|
-
Function which maps array elements to elements in the new array.
|
|
623
|
-
|
|
624
|
-
thisArg: Any (optional)
|
|
625
|
-
Callback execution context.
|
|
626
|
-
|
|
627
|
-
Returns
|
|
628
|
-
-------
|
|
629
|
-
out: Uint8ClampedArray
|
|
630
|
-
A typed array.
|
|
631
|
-
|
|
632
|
-
Examples
|
|
633
|
-
--------
|
|
634
|
-
> var arr1 = new {{alias}}( [ 1, 2, 3 ] );
|
|
635
|
-
> function fcn( v ) { return v * 2; };
|
|
636
|
-
> var arr2 = arr1.map( fcn );
|
|
637
|
-
<Uint8ClampedArray>[ 2, 4, 6 ]
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
{{alias}}.prototype.reduce( fcn[, initialValue] )
|
|
641
|
-
Applies a function against an accumulator and each element in an array and
|
|
642
|
-
returns the accumulated result.
|
|
643
|
-
|
|
644
|
-
The provided function is provided the following arguments:
|
|
645
|
-
|
|
646
|
-
- acc: accumulated result.
|
|
647
|
-
- value: current array element.
|
|
648
|
-
- index: index of the current array element.
|
|
649
|
-
- arr: array on which the method is invoked.
|
|
650
|
-
|
|
651
|
-
If provided an initial value, the method invokes a provided function with
|
|
652
|
-
the initial value as the first argument and the first array element as the
|
|
653
|
-
second argument.
|
|
654
|
-
|
|
655
|
-
If not provided an initial value, the method invokes a provided function
|
|
656
|
-
with the first array element as the first argument and the second array
|
|
657
|
-
element as the second argument.
|
|
658
|
-
|
|
659
|
-
Parameters
|
|
660
|
-
----------
|
|
661
|
-
fcn: Function
|
|
662
|
-
Function to apply.
|
|
663
|
-
|
|
664
|
-
initialValue: Any (optional)
|
|
665
|
-
Initial accumulation value.
|
|
666
|
-
|
|
667
|
-
Returns
|
|
668
|
-
-------
|
|
669
|
-
out: Any
|
|
670
|
-
Accumulated result.
|
|
671
|
-
|
|
672
|
-
Examples
|
|
673
|
-
--------
|
|
674
|
-
> var arr = new {{alias}}( [ 1, 2, 3 ] );
|
|
675
|
-
> function fcn( acc, v ) { return acc + (v*v); };
|
|
676
|
-
> var v = arr.reduce( fcn, 0 )
|
|
677
|
-
14
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
{{alias}}.prototype.reduceRight( fcn[, initialValue] )
|
|
681
|
-
Applies a function against an accumulator and each element in an array and
|
|
682
|
-
returns the accumulated result, iterating from right to left.
|
|
683
|
-
|
|
684
|
-
The provided function is provided the following arguments:
|
|
685
|
-
|
|
686
|
-
- acc: accumulated result.
|
|
687
|
-
- value: current array element.
|
|
688
|
-
- index: index of the current array element.
|
|
689
|
-
- arr: array on which the method is invoked.
|
|
690
|
-
|
|
691
|
-
If provided an initial value, the method invokes a provided function with
|
|
692
|
-
the initial value as the first argument and the last array element as the
|
|
693
|
-
second argument.
|
|
694
|
-
|
|
695
|
-
If not provided an initial value, the method invokes a provided function
|
|
696
|
-
with the last array element as the first argument and the second-to-last
|
|
697
|
-
array element as the second argument.
|
|
698
|
-
|
|
699
|
-
Parameters
|
|
700
|
-
----------
|
|
701
|
-
fcn: Function
|
|
702
|
-
Function to apply.
|
|
703
|
-
|
|
704
|
-
initialValue: Any (optional)
|
|
705
|
-
Initial accumulation value.
|
|
706
|
-
|
|
707
|
-
Returns
|
|
708
|
-
-------
|
|
709
|
-
out: Any
|
|
710
|
-
Accumulated result.
|
|
711
|
-
|
|
712
|
-
Examples
|
|
713
|
-
--------
|
|
714
|
-
> var arr = new {{alias}}( [ 1, 2, 3 ] );
|
|
715
|
-
> function fcn( acc, v ) { return acc + (v*v); };
|
|
716
|
-
> var v = arr.reduceRight( fcn, 0 )
|
|
717
|
-
14
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
{{alias}}.prototype.reverse()
|
|
721
|
-
Reverses an array *in-place*.
|
|
722
|
-
|
|
723
|
-
This method mutates the array on which the method is invoked.
|
|
724
|
-
|
|
725
|
-
Returns
|
|
726
|
-
-------
|
|
727
|
-
out: Uint8ClampedArray
|
|
728
|
-
Modified array.
|
|
729
|
-
|
|
730
|
-
Examples
|
|
731
|
-
--------
|
|
732
|
-
> var arr = new {{alias}}( [ 1, 2, 3 ] )
|
|
733
|
-
<Uint8ClampedArray>[ 1, 2, 3 ]
|
|
734
|
-
> arr.reverse()
|
|
735
|
-
<Uint8ClampedArray>[ 3, 2, 1 ]
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
{{alias}}.prototype.set( arr[, offset] )
|
|
739
|
-
Sets array elements.
|
|
740
|
-
|
|
741
|
-
Parameters
|
|
742
|
-
----------
|
|
743
|
-
arr: ArrayLike
|
|
744
|
-
Source array containing array values to set.
|
|
745
|
-
|
|
746
|
-
offset: integer (optional)
|
|
747
|
-
Array index at which to start writing values. Default: 0.
|
|
748
|
-
|
|
749
|
-
Examples
|
|
750
|
-
--------
|
|
751
|
-
> var arr = new {{alias}}( [ 1, 2, 3 ] );
|
|
752
|
-
> arr.set( [ 4, 4 ], 1 );
|
|
753
|
-
> arr[ 1 ]
|
|
754
|
-
4
|
|
755
|
-
> arr[ 2 ]
|
|
756
|
-
4
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
{{alias}}.prototype.slice( [begin[, end]] )
|
|
760
|
-
Copies array elements to a new array with the same underlying data type as
|
|
761
|
-
the host array.
|
|
762
|
-
|
|
763
|
-
If the method is unable to resolve indices to a non-empty array subsequence,
|
|
764
|
-
the method returns `null`.
|
|
765
|
-
|
|
766
|
-
Parameters
|
|
767
|
-
----------
|
|
768
|
-
begin: integer (optional)
|
|
769
|
-
Start element index (inclusive). If less than zero, the start index is
|
|
770
|
-
resolved relative to the last array element. Default: 0.
|
|
771
|
-
|
|
772
|
-
end: integer (optional)
|
|
773
|
-
End element index (exclusive). If less than zero, the end index is
|
|
774
|
-
resolved relative to the last array element. Default: arr.length.
|
|
775
|
-
|
|
776
|
-
Returns
|
|
777
|
-
-------
|
|
778
|
-
out: Uint8ClampedArray
|
|
779
|
-
A typed array.
|
|
780
|
-
|
|
781
|
-
Examples
|
|
782
|
-
--------
|
|
783
|
-
> var arr1 = new {{alias}}( [ 1, 2, 3 ] );
|
|
784
|
-
> var arr2 = arr1.slice( 1 );
|
|
785
|
-
> arr2.length
|
|
786
|
-
2
|
|
787
|
-
> arr2[ 0 ]
|
|
788
|
-
1
|
|
789
|
-
> arr2[ 1 ]
|
|
790
|
-
2
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
{{alias}}.prototype.some( predicate[, thisArg] )
|
|
794
|
-
Tests whether at least one array element passes a test implemented by a
|
|
795
|
-
predicate function.
|
|
796
|
-
|
|
797
|
-
A predicate function is provided the following arguments:
|
|
798
|
-
|
|
799
|
-
- value: array element.
|
|
800
|
-
- index: array index.
|
|
801
|
-
- arr: array on which the method is invoked.
|
|
802
|
-
|
|
803
|
-
Parameters
|
|
804
|
-
----------
|
|
805
|
-
predicate: Function
|
|
806
|
-
Predicate function which tests array elements. If a predicate function
|
|
807
|
-
returns a truthy value, a array element passes; otherwise, an array
|
|
808
|
-
element fails.
|
|
809
|
-
|
|
810
|
-
thisArg: Any (optional)
|
|
811
|
-
Callback execution context.
|
|
812
|
-
|
|
813
|
-
Returns
|
|
814
|
-
-------
|
|
815
|
-
bool: boolean
|
|
816
|
-
Boolean indicating whether at least one array element passes.
|
|
817
|
-
|
|
818
|
-
Examples
|
|
819
|
-
--------
|
|
820
|
-
> var arr = new {{alias}}( [ 1, 2 ] );
|
|
821
|
-
> function predicate( v ) { return ( v > 1 ); };
|
|
822
|
-
> arr.some( predicate )
|
|
823
|
-
true
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
{{alias}}.prototype.sort( [compareFunction] )
|
|
827
|
-
Sorts an array *in-place*.
|
|
828
|
-
|
|
829
|
-
The comparison function is provided two array elements per invocation: `a`
|
|
830
|
-
and `b`.
|
|
831
|
-
|
|
832
|
-
The comparison function return value determines the sort order as follows:
|
|
833
|
-
|
|
834
|
-
- If the comparison function returns a value less than zero, then the method
|
|
835
|
-
sorts `a` to an index lower than `b` (i.e., `a` should come *before* `b`).
|
|
836
|
-
|
|
837
|
-
- If the comparison function returns a value greater than zero, then the
|
|
838
|
-
method sorts `a` to an index higher than `b` (i.e., `b` should come *before*
|
|
839
|
-
`a`).
|
|
840
|
-
|
|
841
|
-
- If the comparison function returns zero, then the relative order of `a`
|
|
842
|
-
and `b` should remain unchanged.
|
|
843
|
-
|
|
844
|
-
This method mutates the array on which the method is invoked.
|
|
845
|
-
|
|
846
|
-
Parameters
|
|
847
|
-
----------
|
|
848
|
-
compareFunction: Function (optional)
|
|
849
|
-
Function which specifies the sort order. The default sort order is
|
|
850
|
-
ascending order.
|
|
851
|
-
|
|
852
|
-
Returns
|
|
853
|
-
-------
|
|
854
|
-
out: Uint8ClampedArray
|
|
855
|
-
Modified array.
|
|
856
|
-
|
|
857
|
-
Examples
|
|
858
|
-
--------
|
|
859
|
-
> var arr = new {{alias}}( [ 1, 2, 0, 2, 1 ] );
|
|
860
|
-
> arr.sort()
|
|
861
|
-
<Uint8ClampedArray>[ 0, 1, 1, 2, 2 ]
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
{{alias}}.prototype.subarray( [begin[, end]] )
|
|
865
|
-
Creates a new typed array over the same underlying ArrayBuffer and with the
|
|
866
|
-
same underlying data type as the host array.
|
|
867
|
-
|
|
868
|
-
If the method is unable to resolve indices to a non-empty array subsequence,
|
|
869
|
-
the method returns an empty typed array.
|
|
870
|
-
|
|
871
|
-
Parameters
|
|
872
|
-
----------
|
|
873
|
-
begin: integer (optional)
|
|
874
|
-
Start element index (inclusive). If less than zero, the start index is
|
|
875
|
-
resolved relative to the last array element. Default: 0.
|
|
876
|
-
|
|
877
|
-
end: integer (optional)
|
|
878
|
-
End element index (exclusive). If less than zero, the end index is
|
|
879
|
-
resolved relative to the last array element. Default: arr.length.
|
|
880
|
-
|
|
881
|
-
Returns
|
|
882
|
-
-------
|
|
883
|
-
out: Uint8ClampedArray
|
|
884
|
-
A new typed array view.
|
|
885
|
-
|
|
886
|
-
Examples
|
|
887
|
-
--------
|
|
888
|
-
> var arr1 = new {{alias}}( [ 1, 2, 3, 4, 5 ] );
|
|
889
|
-
> var arr2 = arr1.subarray( 2 )
|
|
890
|
-
<Uint8ClampedArray>[ 3, 4, 5 ]
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
{{alias}}.prototype.toLocaleString( [locales[, options]] )
|
|
894
|
-
Serializes an array as a locale-specific string.
|
|
895
|
-
|
|
896
|
-
Parameters
|
|
897
|
-
----------
|
|
898
|
-
locales: string|Array<string> (optional)
|
|
899
|
-
A BCP 47 language tag, or an array of such tags.
|
|
900
|
-
|
|
901
|
-
options: Object (optional)
|
|
902
|
-
Options.
|
|
903
|
-
|
|
904
|
-
Returns
|
|
905
|
-
-------
|
|
906
|
-
str: string
|
|
907
|
-
A typed array string representation.
|
|
908
|
-
|
|
909
|
-
Examples
|
|
910
|
-
--------
|
|
911
|
-
> var arr = new {{alias}}( [ 1, 2, 3 ] );
|
|
912
|
-
> arr.toLocaleString()
|
|
913
|
-
'1,2,3'
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
{{alias}}.prototype.toString()
|
|
917
|
-
Serializes an array as a string.
|
|
918
|
-
|
|
919
|
-
Returns
|
|
920
|
-
-------
|
|
921
|
-
str: string
|
|
922
|
-
A typed array string representation.
|
|
923
|
-
|
|
924
|
-
Examples
|
|
925
|
-
--------
|
|
926
|
-
> var arr = new {{alias}}( [ 1, 2, 3 ] );
|
|
927
|
-
> arr.toString()
|
|
928
|
-
'1,2,3'
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
{{alias}}.prototype.values()
|
|
932
|
-
Returns an iterator for iterating over array elements.
|
|
933
|
-
|
|
934
|
-
Returns
|
|
935
|
-
-------
|
|
936
|
-
iter: Iterator
|
|
937
|
-
Iterator for iterating over array elements.
|
|
938
|
-
|
|
939
|
-
Examples
|
|
940
|
-
--------
|
|
941
|
-
> var arr = new {{alias}}( [ 1, 2 ] );
|
|
942
|
-
> it = arr.values();
|
|
943
|
-
> it.next().value
|
|
944
|
-
1
|
|
945
|
-
> it.next().value
|
|
946
|
-
2
|
|
947
|
-
> it.next().done
|
|
948
|
-
true
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
See Also
|
|
952
|
-
--------
|
|
953
|
-
|