Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

inda

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inda

Initialize new dimensional array

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Initialize new dimensional array

Create a new multi-dimensional array with initialized values.

Example

let inda = require('inda');

// A single-dimensional array where all values are 23
inda(23, 3);
// [23, 23, 23]

// An array with different values via callback
let i = 0;
inda(() => i++), 3);
// [0, 1, 2]

// A two-dimensional array
inda(1, 2, 3);
// [[1, 1, 1], [1, 1, 1]]

// A 12-dimensional array
inda(1, ...inda(1, 12));
// [[[[[[[[[[[[1]]]]]]]]]]]]

// Assigning a function as a value
inda(() => () => 6, 2);
// [() => 6, () => 6)]

Installation

$ npm install inda

API

var inda = require('inda');

inda(initialValue, size, ...sizes)

TypeData TypeNameDescription
parameter*initialValueA value to each element in the array. If a callback is provided, the returned value will be used.
parameternumbersizeThe size of the array to return.
parameter...numbersizesThe sizes of nested-arrays.
returns*[]An array of initialized values.
  • Github: inda

Keywords

FAQs

Package last updated on 28 Jun 2016

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc