VDL Plugin SDK

range

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 range(end): number[];

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

Parameters

ParameterTypeDescription
endnumberThe end number of the range (exclusive).

Returns

number[]

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

Example

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

Call Signature

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

Returns an array of numbers from start (inclusive) to end (exclusive), incrementing 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 start (inclusive) to end (exclusive) with a step of 1.

Example

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

Call Signature

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

Returns an array of numbers from start (inclusive) to end (exclusive), incrementing 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 start (inclusive) to end (exclusive) with the specified step.

Example

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