• get the shape of a 2d array as a 2-tuple describing the major-axis's length, and the minor-axis's length.

    Type Parameters

    • T

    Parameters

    Returns [rows: number, columns: number]

    Example

    const arr2d: Array2DRowMajor<T> = [
    [1 , 2 , 3 , 4 , 5 ],
    [6 , 7 , 8 , 9 , 10],
    [11, 12, 13, 14, 15],
    ]
    const [rows, cols] = shapeOfArray2D(arr2d)
    rows === 3
    cols === 5
  • get the shape of a 2d array as a 2-tuple describing the major-axis's length, and the minor-axis's length.

    Type Parameters

    • T

    Parameters

    Returns [columns: number, rows: number]

    Example

    const arr2d: Array2DRowMajor<T> = [
    [1 , 2 , 3 , 4 , 5 ],
    [6 , 7 , 8 , 9 , 10],
    [11, 12, 13, 14, 15],
    ]
    const [rows, cols] = shapeOfArray2D(arr2d)
    rows === 3
    cols === 5
  • get the shape of a 2d array as a 2-tuple describing the major-axis's length, and the minor-axis's length.

    Type Parameters

    • T

    Parameters

    Returns [major_length: number, minor_length: number]

    Example

    const arr2d: Array2DRowMajor<T> = [
    [1 , 2 , 3 , 4 , 5 ],
    [6 , 7 , 8 , 9 , 10],
    [11, 12, 13, 14, 15],
    ]
    const [rows, cols] = shapeOfArray2D(arr2d)
    rows === 3
    cols === 5

Generated using TypeDoc