Utilities
mappable

mappable

Returns an array of numbers from 0 to size - 1.

Installation

npm install @madeinhaus/utils

Import

import { mappable } from '@madeinhaus/utils';

Parameters

  • size (number): The size of the array to create.

Returns

  • (array): An array of numbers from 0 to size - 1.

Usage

import { mappable } from '@madeinhaus/utils';
 
const numbers = mappable(5); // [0, 1, 2, 3, 4]

In this example, we import the mappable function from the @madeinhaus/utils package and use it to create an array of numbers from 0 to 4.