repl.txt (947B)
1 2 {{alias}}( arr ) 3 Returns a JSON representation of a typed array. 4 5 The following typed array types are supported: 6 7 - Float64Array 8 - Float32Array 9 - Int32Array 10 - Uint32Array 11 - Int16Array 12 - Uint16Array 13 - Int8Array 14 - Uint8Array 15 - Uint8ClampedArray 16 17 The returned JSON object has the following properties: 18 19 - type: typed array type 20 - data: typed array data as a generic array 21 22 The implementation supports custom typed arrays and sets the `type` field to 23 the closest known typed array type. 24 25 Parameters 26 ---------- 27 arr: TypedArray 28 Typed array to serialize. 29 30 Returns 31 ------- 32 out: Object 33 JSON representation. 34 35 Examples 36 -------- 37 > var arr = new {{alias:@stdlib/array/float64}}( 2 ); 38 > arr[ 0 ] = 5.0; 39 > arr[ 1 ] = 3.0; 40 > var json = {{alias}}( arr ) 41 { 'type': 'Float64Array', 'data': [ 5.0, 3.0 ] } 42 43 See Also 44 -------- 45