array-range

WebJar for array-range

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

array-range
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

array-range
WebJar for array-range
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/mattdesl/array-range

Download array-range

How to add to project

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

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.

array-range

stable

Tiny module to create a new dense array with the specified range.

var range = require('array-range')
range(3)       // -> [ 0, 1, 2 ]
range(1, 4)    // -> [ 1, 2, 3 ]

Mainly useful for functional programming. ES6 examples:

var array = require('array-range')

array(5).map( x => x*x )
// -> [ 0, 1, 4, 9, 16 ]

array(2, 10).filter( x => x%2===0 )
// -> [ 2, 4, 6, 8 ]

It can also be useful for creating a fixed size dense array. Cleaner than apply and does not create an intermediate array:

array(5)

//vs.

Array.apply(null, new Array(5))

Usage

NPM

array(start, end)

Creates a new dense array with a length of end-start elements. start is inclusive, end is exclusive. Negative values also work, e.g. range(-10, 10)

array(len)

Creates a new dense array with len number of elements, from zero to len-1.

If len is unspecified, it defaults to zero (empty array).

License

MIT, see LICENSE.md for details.

Versions

Version
1.0.1