v0.2.3
Allow use multiple arrays as one array without create combined one
Repository
Current version released
2 years ago
MultiArray
Deno Document
Don’t trust “import” line on docs! Please read below!
Allows to use multiple arrays as one array.
Use this may reduce “few” memory usage, but access will slower and datas will fragmented.
Please read
Import with ES6
This is ES6 Module. You can not use require()
to import it.
Not all functions from Array was implemented for now.
for..in
No MultiArray doesn’t support for..in
.
Use for..of
or MultiArray.prototype.length
to iterate.
allowJS
should be false when useing generic.
If you are not using TS, you can ignore it.
I have no idea why this happens.
But you should set allowJS
to false to use generic.
This can slow your code
Not recommended to use it without understand its implement.
It can make your program slower without any advantage on specific environments.
Install
node.js
npm install multiarr
deno
no installation required (it will download from internet)
bun.js
bun install multiarr
Usage
deno
import MultiArray from 'https://deno.land/x/multiarray/MultiArray.js';
others
import MultiArray from 'multiarr';
Example
import MultiArray from 'multiarr';
let single = [1, 2, 3, 4];
let square = [1, 4, 9, 16];
let cubic = [1, 8, 27, 64];
const arr = new MultiArray(single, square); // Work as [1, 2, 3, 4, 1, 4, 9, 16]
console.log(arr[6]) // Will log 9
arr.append(cubic) // Can add array to already created MultiArray
arr.remove(0) // Or remove array
console.log(arr[6]) // Will log 27