Skip to content

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

Parameter Type Description
end number The 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

Parameter Type Description
start number The starting number of the range (inclusive).
end number The 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

Parameter Type Description
start number The starting number of the range (inclusive).
end number The end number of the range (exclusive).
step number The 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);