Skip to content

Latest commit

 

History

25 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An array view is a proxy to an underlying array.

▌ 📦 JSR, 📦 NPM, 📰 Docs.


This package provides a view to an underlying array. It is a proxy of the array, and any changes made to it are reflected in the underlying array. It is similar to a slice of an array, but it does not copy the array. To obtain a view, use the fromArray() function.


import * as xarrayView from "jsr:@nodef/extra-array-view";

var x = [10, 40, 30, 20, 50];
var y = xarrayView.fromArray(x, 1, 4);

y[0];
// → 40

y[1];
// → 30

y.at(-1);
// → 20

y.sort();
x;
// → [ 10, 20, 30, 40, 50 ]

y.reverse();
x;
// → [ 10, 40, 30, 20, 50 ]

y.fill(0);
x;
// → [ 10, 0, 0, 0, 50 ]


Index

Property Description
fromArray Convert array range to array view.


References




ORG

About

An array view is a proxy to an underlying array.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Used by

Contributors

Languages