VDL Plugin SDK

rangeRight

Import from @varavel/vdl-plugin-sdk/utils/math.

Utility functions re-exported from es-toolkit (MIT License). See https://github.com/toss/es-toolkit for more details.

Call Signature

function rangeRight(end): number[];

Returns an array of numbers from end (exclusive) to 0 (inclusive), decrementing by 1.

Parameters

ParameterTypeDescription
endnumberThe end number of the range (exclusive).

Returns

number[]

An array of numbers from end (exclusive) to 0 (inclusive) with a step of 1.

Example

// Returns [3, 2, 1, 0]
rangeRight(4);

Call Signature

function rangeRight(start, end): number[];

Returns an array of numbers from end (exclusive) to start (inclusive), decrementing by 1.

Parameters

ParameterTypeDescription
startnumberThe starting number of the range (inclusive).
endnumberThe end number of the range (exclusive).

Returns

number[]

An array of numbers from end (exclusive) to start (inclusive) with a step of 1.

Example

// Returns [3, 2, 1]
rangeRight(1, 4);

Call Signature

function rangeRight(
   start, 
   end, 
   step
): number[];

Returns an array of numbers from end (exclusive) to start (inclusive), decrementing by step.

Parameters

ParameterTypeDescription
startnumberThe starting number of the range (inclusive).
endnumberThe end number of the range (exclusive).
stepnumberThe step value for the range.

Returns

number[]

An array of numbers from end (exclusive) to start (inclusive) with the specified step.

Example

// Returns [15, 10, 5, 0]
rangeRight(0, 20, 5);