@@ -207,63 +207,34 @@ var len = arr.length;
207207
208208<a name =" static-method-from " ></a >
209209
210- #### factory .from( src\[ , map\[ , thisArg]] )
210+ #### Float32Array .from( src\[ , map\[ , thisArg]] )
211211
212- Creates a new named typed tuple from an array-like ` object ` or an iterable.
212+ Creates a new typed array from an array-like ` object ` or an iterable.
213213
214214``` javascript
215- var factory = namedtypedtuple ( [ ' x' , ' y' ] );
216-
217- var tuple = factory .from ( [ 1.0 , - 1.0 ] );
218-
219- var x = tuple .x ;
220- // returns 1.0
221-
222- x = tuple[ 0 ];
223- // returns 1.0
224-
225- var y = tuple .y ;
226- // returns -1.0
227-
228- y = tuple[ 1 ];
229- // returns -1.0
215+ var arr = Float32Array .from ( [ 1.0 , - 1.0 ] );
216+ // returns <Float32Array>[ 1.0, -1.0 ]
230217```
231218
232219To invoke a function for each ` src ` value, provide a callback function.
233220
234221``` javascript
235- var factory = namedtypedtuple ( [ ' x' , ' y' ] );
236-
237222function mapFcn ( v ) {
238223 return v * 2.0 ;
239224}
240225
241- var tuple = factory .from ( [ 1.0 , - 1.0 ], mapFcn );
242-
243- var x = tuple .x ;
244- // returns 2.0
245-
246- x = tuple[ 0 ];
247- // returns 2.0
248-
249- var y = tuple .y ;
250- // returns -2.0
251-
252- y = tuple[ 1 ];
253- // returns -2.0
226+ var arr = Float32Array .from ( [ 1.0 , - 1.0 ], mapFcn );
227+ // returns <Float32Array>[ 2.0, -2.0 ]
254228```
255229
256- A callback function is provided three arguments:
230+ A callback function is provided two arguments:
257231
258232- ` value ` : source value
259233- ` index ` : source index
260- - ` field ` : tuple field
261234
262235To set the callback execution context, provide a ` thisArg ` .
263236
264237``` javascript
265- var factory = namedtypedtuple ( [ ' x' , ' y' ] );
266-
267238function mapFcn ( v ) {
268239 this .count += 1 ;
269240 return v * 2.0 ;
@@ -273,34 +244,22 @@ var ctx = {
273244 ' count' : 0
274245};
275246
276- var tuple = factory .from ( [ 1.0 , - 1.0 ], mapFcn, ctx );
247+ var arr = Float32Array .from ( [ 1.0 , - 1.0 ], mapFcn, ctx );
248+ // returns <Float32Array>[ 2.0, -2.0 ]
277249
278250var n = ctx .count ;
279251// returns 2
280252```
281253
282254<a name =" static-method-of " ></a >
283255
284- #### factory .of( element0\[ , element1\[ , ...\[ , elementN]]] )
256+ #### Float32Array .of( element0\[ , element1\[ , ...\[ , elementN]]] )
285257
286- Creates a new named typed tuple from a variable number of arguments.
258+ Creates a new typed array from a variable number of arguments.
287259
288260``` javascript
289- var factory = namedtypedtuple ( [ ' x' , ' y' ] );
290-
291- var tuple = factory .of ( 1.0 , - 1.0 );
292-
293- var x = tuple .x ;
294- // returns 1.0
295-
296- x = tuple[ 0 ];
297- // returns 1.0
298-
299- var y = tuple .y ;
300- // returns -1.0
301-
302- y = tuple[ 1 ];
303- // returns -1.0
261+ var arr = Float32Array .of ( 1.0 , - 1.0 );
262+ // returns <Float32Array>[ 1.0, -1.0 ]
304263```
305264
306265</section >
0 commit comments