Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Index

Interfaces

Type aliases

Functions

Type aliases

Getter

Getter: (data: Collection, idx: number) => any

Returns an array element.

param

array data

param

element index

returns

element value

Type declaration

Setter

Setter: (data: Collection, idx: number, value: any) => void

Sets an array element.

param

array data

param

element index

param

value to set

Type declaration

    • (data: Collection, idx: number, value: any): void
    • Parameters

      Returns void

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 ArrayObject

    object containing array data

    Example

    var x = [ 1, 2, 3, 4, 5, 6 ];
    
    var obj = arraylike2object( x );
    // returns {...}