Socket
Socket
Sign inDemoInstall

create-array

Package Overview
Dependencies
0
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    create-array

create an array from a given size and a generator


Version published
Weekly downloads
4
decreased by-66.67%
Maintainers
2
Install size
3.97 kB
Created
Weekly downloads
 

Readme

Source

create-array Build Status

Create an array from a given size and a generator

Features

  • Compatible Node & browsers
  • Pre-allocate array for better performance.

Installation

Node & Browserify/Webpack

Installation of the npm package:

> npm install --save create-array

Then require the package:

var createArray = require('create-array');

Browser

You can directly use the build provided at unpkg.com:

<script src="https://unpkg.com/create-array@1/dist/create-array.js"></script>

Usage

var array = createArray(length, generator):

// From a value.
console.log(createArray(3, 'foo'));
// → ['foo', 'foo', 'foo']

// With a function.
console.log(createArray(3, function (i) {
  return 'item #' + i;
}));
// → ['item #0', 'item #1', 'item #2']

Contributions

Contributions are very welcomed, either on the documentation or on the code.

You may:

  • report any issue you've encountered;
  • fork and create a pull request.

License

ISC © Julien Fontanet

Keywords

FAQs

Last updated on 25 Jun 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc