Skip to content

Allow use multiple arrays as one array without create combined one

License

Notifications You must be signed in to change notification settings

Preta-Crowz/MultiArray

Repository files navigation

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.

No for..in

MultiArray doesn't support for..in.
Use for..of or MultiArray.prototype.length to iterate.

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

About

Allow use multiple arrays as one array without create combined one

Resources

License

Stars

Watchers

Forks

Packages

No packages published