daShangDao_newAdmin/node_modules/iota-array
2025-06-05 10:35:45 +08:00
..
.npmignore Initial commit 2025-06-05 10:35:45 +08:00
iota.js Initial commit 2025-06-05 10:35:45 +08:00
LICENSE Initial commit 2025-06-05 10:35:45 +08:00
package.json Initial commit 2025-06-05 10:35:45 +08:00
README.md Initial commit 2025-06-05 10:35:45 +08:00

iota-array

Fills an array with sequential integers. Just like C++'s std::iota() or the similarly named function in APL.

Install

npm install iota-array

Example


console.log(require("iota-array")(3))

//Prints:
//
//    [0,1,2]
//

require("iota-array")(n)

Constructs an array of length n of n sequential integers starting from 0.

  • n the length of the array to construct

Returns: An array of n sequential integers starting at 0

Credits

(c) 2013 Mikola Lysenko. MIT License