1.0.1 • Published 2 years ago
@mbdo/array-builder v1.0.1
Array builder package
This ESM npm package exports utilities to build numeric arrays.
To start, it provides a function createArrayWithLength that allows you to create an array with a specified length n, with values from 1 to n.
Installation
Install the package using npm:
npm install @mbdo/array-builderUsage
Import the package:
import { createArrayWithLength } from 'array-creation-util';Call the function createArrayWithLength with the desired length as an argument to get an array containing numbers from 1 to the specified length:
const length = 5;
const newArray = createArrayWithLength(length);
console.log(newArray); // Output: [1, 2, 3, 4, 5]API
createArrayWithLength(length)
Creates an array with a specified length.
length(number): The desired length of the array.
Returns:
- (Array): An array containing numbers from 1 to the specified length.
License
This package is released under the MIT License. Please update the package name and other details as per your requirements.