Skip to content
This repository has been archived by the owner on Apr 1, 2023. It is now read-only.

Latest commit

 

History

History
49 lines (39 loc) · 1.92 KB

fill.md

File metadata and controls

49 lines (39 loc) · 1.92 KB

Object Agent

A javascript library for working with objects

npm build coverage deps size vulnerabilities license


fill(length, [callback]) ⇒ Array

Returns an array of specified length filled with either the index value or the value returned from the provided callback

Param Type Description
length integer
[callback] function provides one argument, the index of the returned array

Example

import { fill } from 'object-agent';

fill(5);
// => [0, 1, 2, 3, 4]

fill(3, (index) => index * 3);
// => [0, 3, 6]