UNPKG

@stdlib/array

Version:
59 lines (42 loc) 1.51 kB
{{alias}}( x ) Converts an array-like object to an object likely to have the same "shape". The returned object has the following properties: - data: reference to input array. - dtype: input array data type. - accessorProtocol: boolean indicating whether the input array uses accessors for getting and setting elements. - accessors: a two-element array whose first element is an accessor for retrieving an array element and whose second element is an accessor for setting an array element. The getter accessor accepts two arguments: - data: data buffer. - idx: element index. The setter accessor accepts three arguments: - data: data buffer. - idx: element index. - value: value to set. Parameters ---------- x: ArrayLikeObject Input array. Returns ------- out: Object Object containing array data. out.data: ArrayLikeObject Reference to input array. out.dtype: string|null Input array data type. out.accessorProtocol: boolean Boolean indicating whether the input array uses accessors for getting and setting elements. out.accessors: Array<Function> A two-element array whose first element is an accessor for retrieving an array element and whose second element is an accessor for setting an array element. Examples -------- > var out = {{alias}}( [ 1, 2, 3, 4 ] ) {...} See Also --------