Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "array/base/arraylike2object/docs/types/index.d"

Index

Type aliases

GetAccessorArrayLike

GetAccessorArrayLike<T>: (arr: AccessorArrayLike<T>, idx: number) => T | void

Returns an element from an array-like object supporting the get/set protocol.

param

input array

param

element index

returns

element value

Type parameters

  • T

Type declaration

GetComplex128

GetComplex128: (arr: Complex128Array, idx: number) => Complex128 | void

Returns an element from a Complex128Array.

param

input array

param

element index

returns

element value

Type declaration

GetComplex64

GetComplex64: (arr: Complex64Array, idx: number) => Complex64 | void

Returns an element from a Complex64Array.

param

input array

param

element index

returns

element value

Type declaration

GetFloat32

GetFloat32: (arr: Float32Array, idx: number) => number | void

Returns an element from a Float32Array.

param

input array

param

element index

returns

element value

Type declaration

GetFloat64

GetFloat64: (arr: Float64Array, idx: number) => number | void

Returns an element from a Float64Array.

param

input array

param

element index

returns

element value

Type declaration

GetGeneric

GetGeneric<T>: (arr: Array<T>, idx: number) => T | void

Returns an element from a generic Array.

param

input array

param

element index

returns

element value

Type parameters

  • T

Type declaration

    • (arr: Array<T>, idx: number): T | void
    • Parameters

      • arr: Array<T>
      • idx: number

      Returns T | void

GetIndexedArrayLike

GetIndexedArrayLike<T>: (arr: Collection<T>, idx: number) => T | void

Returns an element from an indexed array-like object.

param

input array

param

element index

returns

element value

Type parameters

  • T

Type declaration

    • Parameters

      Returns T | void

GetInt16

GetInt16: (arr: Int16Array, idx: number) => number | void

Returns an element from an Int16Array.

param

input array

param

element index

returns

element value

Type declaration

    • Parameters

      Returns number | void

GetInt32

GetInt32: (arr: Int32Array, idx: number) => number | void

Returns an element from an Int32Array.

param

input array

param

element index

returns

element value

Type declaration

    • Parameters

      Returns number | void

GetInt8

GetInt8: (arr: Int8Array, idx: number) => number | void

Returns an element from an Int8Array.

param

input array

param

element index

returns

element value

Type declaration

    • (arr: Int8Array, idx: number): number | void
    • Parameters

      Returns number | void

GetUint16

GetUint16: (arr: Uint16Array, idx: number) => number | void

Returns an element from a Uint16Array.

param

input array

param

element index

returns

element value

Type declaration

    • Parameters

      Returns number | void

GetUint32

GetUint32: (arr: Uint32Array, idx: number) => number | void

Returns an element from a Uint32Array.

param

input array

param

element index

returns

element value

Type declaration

    • Parameters

      Returns number | void

GetUint8

GetUint8: (arr: Uint8Array, idx: number) => number | void

Returns an element from a Uint8Array.

param

input array

param

element index

returns

element value

Type declaration

    • Parameters

      Returns number | void

GetUint8c

GetUint8c: (arr: Uint8ClampedArray, idx: number) => number | void

Returns an element from a Uint8ClampedArray.

param

input array

param

element index

returns

element value

Type declaration

SetAccessorArrayLike

SetAccessorArrayLike<T>: (arr: AccessorArrayLike<T>, idx: number, value: T) => void

Sets an element in an array-like object supporting the get/set protocol.

param

input array

param

element index

param

value to set

Type parameters

  • T

Type declaration

SetComplex128

SetComplex128: (arr: Complex128Array, idx: number, value: ComplexLike) => void

Sets an element in a Complex128Array.

param

input array

param

element index

param

value to set

Type declaration

SetComplex64

SetComplex64: (arr: Complex64Array, idx: number, value: ComplexLike) => void

Sets an element in a Complex64Array.

param

input array

param

element index

param

value to set

Type declaration

SetFloat32

SetFloat32: (arr: Float32Array, idx: number, value: number) => void

Sets an element in a Float32Array.

param

input array

param

element index

param

value to set

Type declaration

    • Parameters

      Returns void

SetFloat64

SetFloat64: (arr: Float64Array, idx: number, value: number) => void

Sets an element in a Float64Array.

param

input array

param

element index

param

value to set

Type declaration

    • Parameters

      Returns void

SetGeneric

SetGeneric<T>: (arr: Array<T>, idx: number, value: T) => void

Sets an element in a generic Array.

param

input array

param

element index

param

value to set

Type parameters

  • T

Type declaration

    • (arr: Array<T>, idx: number, value: T): void
    • Parameters

      • arr: Array<T>
      • idx: number
      • value: T

      Returns void

SetIndexedArrayLike

SetIndexedArrayLike<T>: (arr: Collection<T>, idx: number, value: T) => void

Sets an element in an indexed array-like object.

param

input array

param

element index

param

value to set

Type parameters

  • T

Type declaration

    • (arr: Collection<T>, idx: number, value: T): void
    • Parameters

      Returns void

SetInt16

SetInt16: (arr: Int16Array, idx: number, value: number) => void

Sets an element in an Int16Array.

param

input array

param

element index

param

value to set

Type declaration

    • (arr: Int16Array, idx: number, value: number): void
    • Parameters

      Returns void

SetInt32

SetInt32: (arr: Int32Array, idx: number, value: number) => void

Sets an element in an Int32Array.

param

input array

param

element index

param

value to set

Type declaration

    • (arr: Int32Array, idx: number, value: number): void
    • Parameters

      Returns void

SetInt8

SetInt8: (arr: Int8Array, idx: number, value: number) => void

Sets an element in an Int8Array.

param

input array

param

element index

param

value to set

Type declaration

    • (arr: Int8Array, idx: number, value: number): void
    • Parameters

      Returns void

SetUint16

SetUint16: (arr: Uint16Array, idx: number, value: number) => void

Sets an element in a Uint16Array.

param

input array

param

element index

param

value to set

Type declaration

    • Parameters

      Returns void

SetUint32

SetUint32: (arr: Uint32Array, idx: number, value: number) => void

Sets an element in a Uint32Array.

param

input array

param

element index

param

value to set

Type declaration

    • Parameters

      Returns void

SetUint8

SetUint8: (arr: Uint8Array, idx: number, value: number) => void

Sets an element in a Uint8Array.

param

input array

param

element index

param

value to set

Type declaration

    • (arr: Uint8Array, idx: number, value: number): void
    • Parameters

      Returns void

SetUint8c

SetUint8c: (arr: Uint8ClampedArray, idx: number, value: number) => void

Sets an element in a Uint8ClampedArray.

param

input array

param

element index

param

value to set

Type declaration

Functions

Export assignment arraylike2object

  • Converts a one-dimensional array-like object to an object likely to have the same "shape".

    Notes

    • This function is intended as a potential performance optimization. In V8, for example, even if two objects share common properties, if those properties were added in different orders or if one object has additional properties not shared by the other object, then those objects will have different "hidden" classes. If a function is provided many objects having different "shapes", some JavaScript VMs (e.g., V8) will consider the function "megamorphic" and fail to perform various runtime optimizations. Accordingly, the intent of this function is to standardize the "shape" of the object holding array data to ensure that internal functions operating on arrays are provided consistent argument "shapes".

    Parameters

    Returns Float64AccessorObject

    object containing array data

    Example

    var Float64Array = require( '@stdlib/array/float64' );
    
    var x = new Float64Array( [ 1, 2, 3, 4 ] );
    var obj = arraylike2object( x );
    // returns {...}
    
    var bool = obj.accessorProtocol;
    // returns false
    
    var fcns = obj.accessors;
    // returns [ <Function>, <Function> ]
    
    var v = fcns[ 0 ]( x.data, 2 );
    // returns 3
  • Converts a one-dimensional array-like object to an object likely to have the same "shape".

    Notes

    • This function is intended as a potential performance optimization. In V8, for example, even if two objects share common properties, if those properties were added in different orders or if one object has additional properties not shared by the other object, then those objects will have different "hidden" classes. If a function is provided many objects having different "shapes", some JavaScript VMs (e.g., V8) will consider the function "megamorphic" and fail to perform various runtime optimizations. Accordingly, the intent of this function is to standardize the "shape" of the object holding array data to ensure that internal functions operating on arrays are provided consistent argument "shapes".

    Parameters

    Returns Float32AccessorObject

    object containing array data

    Example

    var Float32Array = require( '@stdlib/array/float32' );
    
    var x = new Float32Array( [ 1, 2, 3, 4 ] );
    var obj = arraylike2object( x );
    // returns {...}
    
    var bool = obj.accessorProtocol;
    // returns false
    
    var fcns = obj.accessors;
    // returns [ <Function>, <Function> ]
    
    var v = fcns[ 0 ]( x.data, 2 );
    // returns 3
  • Converts a one-dimensional array-like object to an object likely to have the same "shape".

    Notes

    • This function is intended as a potential performance optimization. In V8, for example, even if two objects share common properties, if those properties were added in different orders or if one object has additional properties not shared by the other object, then those objects will have different "hidden" classes. If a function is provided many objects having different "shapes", some JavaScript VMs (e.g., V8) will consider the function "megamorphic" and fail to perform various runtime optimizations. Accordingly, the intent of this function is to standardize the "shape" of the object holding array data to ensure that internal functions operating on arrays are provided consistent argument "shapes".

    Parameters

    Returns Int32AccessorObject

    object containing array data

    Example

    var Int32Array = require( '@stdlib/array/int32' );
    
    var x = new Int32Array( [ 1, 2, 3, 4 ] );
    var obj = arraylike2object( x );
    // returns {...}
    
    var bool = obj.accessorProtocol;
    // returns false
    
    var fcns = obj.accessors;
    // returns [ <Function>, <Function> ]
    
    var v = fcns[ 0 ]( x.data, 2 );
    // returns 3
  • Converts a one-dimensional array-like object to an object likely to have the same "shape".

    Notes

    • This function is intended as a potential performance optimization. In V8, for example, even if two objects share common properties, if those properties were added in different orders or if one object has additional properties not shared by the other object, then those objects will have different "hidden" classes. If a function is provided many objects having different "shapes", some JavaScript VMs (e.g., V8) will consider the function "megamorphic" and fail to perform various runtime optimizations. Accordingly, the intent of this function is to standardize the "shape" of the object holding array data to ensure that internal functions operating on arrays are provided consistent argument "shapes".

    Parameters

    Returns Int16AccessorObject

    object containing array data

    Example

    var Int16Array = require( '@stdlib/array/int16' );
    
    var x = new Int16Array( [ 1, 2, 3, 4 ] );
    var obj = arraylike2object( x );
    // returns {...}
    
    var bool = obj.accessorProtocol;
    // returns false
    
    var fcns = obj.accessors;
    // returns [ <Function>, <Function> ]
    
    var v = fcns[ 0 ]( x.data, 2 );
    // returns 3
  • Converts a one-dimensional array-like object to an object likely to have the same "shape".

    Notes

    • This function is intended as a potential performance optimization. In V8, for example, even if two objects share common properties, if those properties were added in different orders or if one object has additional properties not shared by the other object, then those objects will have different "hidden" classes. If a function is provided many objects having different "shapes", some JavaScript VMs (e.g., V8) will consider the function "megamorphic" and fail to perform various runtime optimizations. Accordingly, the intent of this function is to standardize the "shape" of the object holding array data to ensure that internal functions operating on arrays are provided consistent argument "shapes".

    Parameters

    Returns Int8AccessorObject

    object containing array data

    Example

    var Int8Array = require( '@stdlib/array/int8' );
    
    var x = new Int8Array( [ 1, 2, 3, 4 ] );
    var obj = arraylike2object( x );
    // returns {...}
    
    var bool = obj.accessorProtocol;
    // returns false
    
    var fcns = obj.accessors;
    // returns [ <Function>, <Function> ]
    
    var v = fcns[ 0 ]( x.data, 2 );
    // returns 3
  • Converts a one-dimensional array-like object to an object likely to have the same "shape".

    Notes

    • This function is intended as a potential performance optimization. In V8, for example, even if two objects share common properties, if those properties were added in different orders or if one object has additional properties not shared by the other object, then those objects will have different "hidden" classes. If a function is provided many objects having different "shapes", some JavaScript VMs (e.g., V8) will consider the function "megamorphic" and fail to perform various runtime optimizations. Accordingly, the intent of this function is to standardize the "shape" of the object holding array data to ensure that internal functions operating on arrays are provided consistent argument "shapes".

    Parameters

    Returns Uint32AccessorObject

    object containing array data

    Example

    var Uint32Array = require( '@stdlib/array/uint32' );
    
    var x = new Uint32Array( [ 1, 2, 3, 4 ] );
    var obj = arraylike2object( x );
    // returns {...}
    
    var bool = obj.accessorProtocol;
    // returns false
    
    var fcns = obj.accessors;
    // returns [ <Function>, <Function> ]
    
    var v = fcns[ 0 ]( x.data, 2 );
    // returns 3
  • Converts a one-dimensional array-like object to an object likely to have the same "shape".

    Notes

    • This function is intended as a potential performance optimization. In V8, for example, even if two objects share common properties, if those properties were added in different orders or if one object has additional properties not shared by the other object, then those objects will have different "hidden" classes. If a function is provided many objects having different "shapes", some JavaScript VMs (e.g., V8) will consider the function "megamorphic" and fail to perform various runtime optimizations. Accordingly, the intent of this function is to standardize the "shape" of the object holding array data to ensure that internal functions operating on arrays are provided consistent argument "shapes".

    Parameters

    Returns Uint16AccessorObject

    object containing array data

    Example

    var Uint16Array = require( '@stdlib/array/uint16' );
    
    var x = new Uint16Array( [ 1, 2, 3, 4 ] );
    var obj = arraylike2object( x );
    // returns {...}
    
    var bool = obj.accessorProtocol;
    // returns false
    
    var fcns = obj.accessors;
    // returns [ <Function>, <Function> ]
    
    var v = fcns[ 0 ]( x.data, 2 );
    // returns 3
  • Converts a one-dimensional array-like object to an object likely to have the same "shape".

    Notes

    • This function is intended as a potential performance optimization. In V8, for example, even if two objects share common properties, if those properties were added in different orders or if one object has additional properties not shared by the other object, then those objects will have different "hidden" classes. If a function is provided many objects having different "shapes", some JavaScript VMs (e.g., V8) will consider the function "megamorphic" and fail to perform various runtime optimizations. Accordingly, the intent of this function is to standardize the "shape" of the object holding array data to ensure that internal functions operating on arrays are provided consistent argument "shapes".

    Parameters

    Returns Uint8AccessorObject

    object containing array data

    Example

    var Uint8Array = require( '@stdlib/array/uint8' );
    
    var x = new Uint8Array( [ 1, 2, 3, 4 ] );
    var obj = arraylike2object( x );
    // returns {...}
    
    var bool = obj.accessorProtocol;
    // returns false
    
    var fcns = obj.accessors;
    // returns [ <Function>, <Function> ]
    
    var v = fcns[ 0 ]( x.data, 2 );
    // returns 3
  • Converts a one-dimensional array-like object to an object likely to have the same "shape".

    Notes

    • This function is intended as a potential performance optimization. In V8, for example, even if two objects share common properties, if those properties were added in different orders or if one object has additional properties not shared by the other object, then those objects will have different "hidden" classes. If a function is provided many objects having different "shapes", some JavaScript VMs (e.g., V8) will consider the function "megamorphic" and fail to perform various runtime optimizations. Accordingly, the intent of this function is to standardize the "shape" of the object holding array data to ensure that internal functions operating on arrays are provided consistent argument "shapes".

    Parameters

    Returns Uint8cAccessorObject

    object containing array data

    Example

    var Uint8ClampedArray = require( '@stdlib/array/uint8c' );
    
    var x = new Uint8ClampedArray( [ 1, 2, 3, 4 ] );
    var obj = arraylike2object( x );
    // returns {...}
    
    var bool = obj.accessorProtocol;
    // returns false
    
    var fcns = obj.accessors;
    // returns [ <Function>, <Function> ]
    
    var v = fcns[ 0 ]( x.data, 2 );
    // returns 3
  • Converts a one-dimensional array-like object to an object likely to have the same "shape".

    Notes

    • This function is intended as a potential performance optimization. In V8, for example, even if two objects share common properties, if those properties were added in different orders or if one object has additional properties not shared by the other object, then those objects will have different "hidden" classes. If a function is provided many objects having different "shapes", some JavaScript VMs (e.g., V8) will consider the function "megamorphic" and fail to perform various runtime optimizations. Accordingly, the intent of this function is to standardize the "shape" of the object holding array data to ensure that internal functions operating on arrays are provided consistent argument "shapes".

    Parameters

    Returns Complex128AccessorObject

    object containing array data

    Example

    var Complex128Array = require( '@stdlib/array/complex128' );
    
    var x = new Complex128Array( [ 1, 2, 3, 4 ] );
    var obj = arraylike2object( x );
    // returns {...}
    
    var bool = obj.accessorProtocol;
    // returns true
    
    var fcns = obj.accessors;
    // returns [ <Function>, <Function> ]
    
    var v = fcns[ 0 ]( x, 1 );
    // returns <Complex128>
  • Converts a one-dimensional array-like object to an object likely to have the same "shape".

    Notes

    • This function is intended as a potential performance optimization. In V8, for example, even if two objects share common properties, if those properties were added in different orders or if one object has additional properties not shared by the other object, then those objects will have different "hidden" classes. If a function is provided many objects having different "shapes", some JavaScript VMs (e.g., V8) will consider the function "megamorphic" and fail to perform various runtime optimizations. Accordingly, the intent of this function is to standardize the "shape" of the object holding array data to ensure that internal functions operating on arrays are provided consistent argument "shapes".

    Parameters

    Returns Complex64AccessorObject

    object containing array data

    Example

    var Complex64Array = require( '@stdlib/array/complex64' );
    
    var x = new Complex64Array( [ 1, 2, 3, 4 ] );
    var obj = arraylike2object( x );
    // returns {...}
    
    var bool = obj.accessorProtocol;
    // returns true
    
    var fcns = obj.accessors;
    // returns [ <Function>, <Function> ]
    
    var v = fcns[ 0 ]( x, 1 );
    // returns <Complex64>
  • Converts a one-dimensional array-like object to an object likely to have the same "shape".

    Notes

    • This function is intended as a potential performance optimization. In V8, for example, even if two objects share common properties, if those properties were added in different orders or if one object has additional properties not shared by the other object, then those objects will have different "hidden" classes. If a function is provided many objects having different "shapes", some JavaScript VMs (e.g., V8) will consider the function "megamorphic" and fail to perform various runtime optimizations. Accordingly, the intent of this function is to standardize the "shape" of the object holding array data to ensure that internal functions operating on arrays are provided consistent argument "shapes".

    Type parameters

    • T

    Parameters

    Returns GetSetAccessorObject < T >

    object containing array data

    Example

    var x = [ 1, 2, 3, 4 ];
    
    function get( idx ) {
        return x[ idx ];
    }
    
    function set( value, idx ) {
        x[ idx ] = value;
    }
    
    x.get = get;
    x.set = set;
    
    var obj = arraylike2object( x );
    // returns {...}
    
    var bool = obj.accessorProtocol;
    // returns true
    
    var fcns = obj.accessors;
    // returns [ <Function>, <Function> ]
    
    var v = fcns[ 0 ]( x.data, 2 );
    // returns 3
  • Converts a one-dimensional array-like object to an object likely to have the same "shape".

    Notes

    • This function is intended as a potential performance optimization. In V8, for example, even if two objects share common properties, if those properties were added in different orders or if one object has additional properties not shared by the other object, then those objects will have different "hidden" classes. If a function is provided many objects having different "shapes", some JavaScript VMs (e.g., V8) will consider the function "megamorphic" and fail to perform various runtime optimizations. Accordingly, the intent of this function is to standardize the "shape" of the object holding array data to ensure that internal functions operating on arrays are provided consistent argument "shapes".

    Type parameters

    • T

    Parameters

    • x: Array<T>

      input array

    Returns GenericAccessorObject < T >

    object containing array data

    Example

    var x = [ 1, 2, 3, 4 ];
    var obj = arraylike2object( x );
    // returns {...}
    
    var bool = obj.accessorProtocol;
    // returns false
    
    var fcns = obj.accessors;
    // returns [ <Function>, <Function> ]
    
    var v = fcns[ 0 ]( x.data, 2 );
    // returns 3
  • Converts a one-dimensional array-like object to an object likely to have the same "shape".

    Notes

    • This function is intended as a potential performance optimization. In V8, for example, even if two objects share common properties, if those properties were added in different orders or if one object has additional properties not shared by the other object, then those objects will have different "hidden" classes. If a function is provided many objects having different "shapes", some JavaScript VMs (e.g., V8) will consider the function "megamorphic" and fail to perform various runtime optimizations. Accordingly, the intent of this function is to standardize the "shape" of the object holding array data to ensure that internal functions operating on arrays are provided consistent argument "shapes".

    Type parameters

    • T

    Parameters

    Returns IndexedAccessorObject < T >

    object containing array data

    Example

    var x = {
        '0': 1,
        '1': 2,
        '2': 3,
        '4': 4,
        'length': 4
    };
    var obj = arraylike2object( x );
    // returns {...}
    
    var bool = obj.accessorProtocol;
    // returns false
    
    var fcns = obj.accessors;
    // returns [ <Function>, <Function> ]
    
    var v = fcns[ 0 ]( x.data, 2 );
    // returns 3