filled-array

WebJar for filled-array

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

filled-array
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

filled-array
WebJar for filled-array
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/sindresorhus/filled-array

Download filled-array

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/filled-array/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>filled-array</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/filled-array/
implementation 'org.webjars.npm:filled-array:1.1.0'
// https://jarcasting.com/artifacts/org.webjars.npm/filled-array/
implementation ("org.webjars.npm:filled-array:1.1.0")
'org.webjars.npm:filled-array:jar:1.1.0'
<dependency org="org.webjars.npm" name="filled-array" rev="1.1.0">
  <artifact name="filled-array" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='filled-array', version='1.1.0')
)
libraryDependencies += "org.webjars.npm" % "filled-array" % "1.1.0"
[org.webjars.npm/filled-array "1.1.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

filled-array

Returns an array filled with the specified input

Install

$ npm install --save filled-array

Usage

const filledArray = require('filled-array');

filledArray('x', 3);
//=> ['x', 'x', 'x']

filledArray(0, 3);
//=> [0, 0, 0]

filledArray(i => {
	return (++i % 3 ? '' : 'Fizz') + (i % 5 ? '' : 'Buzz') || i;
}, 15);
//=> [1, 2, 'Fizz', 4, 'Buzz', 'Fizz', 7, 8, 'Fizz', 'Buzz', 11, 'Fizz', 13, 14, 'FizzBuzz']

API

filledArray(filler, count)

filler

Type: Any

Value to fill the array with.

You can pass a function to generate the array items dynamically. The function is expected to return the value for each iteration and will be called with the following arguments: index, the count you passed in, and the filled array thus far.

count

Type: number

Number of items to fill the array with.

License

MIT © Sindre Sorhus

Versions

Version
1.1.0