@mbdo/array-builder

1.0.1 • Public • Published

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-builder

Usage

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.

Readme

Keywords

Package Sidebar

Install

npm i @mbdo/array-builder

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

2.42 kB

Total Files

6

Last publish

Collaborators

  • mbdo