1.0.1 ā€¢ Published 12 months ago

extra-array-view.web v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

An array view is a proxy to an underlying array. šŸ“¦ Node.js, šŸŒ Web, šŸ“œ Files, šŸ“° Docs, šŸ“˜ Wiki.

npm.io

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.

With this package, you can simplify the implementation of complex algorithms. Try it out today! This package is available in Node.js and Web formats. To use it on the web, simply use the extra_array_view global variable after loading with a <script> tag from the jsDelivr CDN.

Stability: Experimental.

const xarrayView = require('extra-array-view');
// import * as xarrayView from "extra-array-view";
// import * as xarrayView from "https://unpkg.com/extra-array-view/index.mjs"; (deno)

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

PropertyDescription
fromArrayConvert array range to array view.

References

npm.io ORG Coverage Status Test Coverage

1.0.1

12 months ago

1.0.0

12 months ago

0.1.1

12 months ago

0.1.0

12 months ago

0.0.41

12 months ago

0.0.40

12 months ago

0.0.39

12 months ago

0.0.38

12 months ago

0.0.37

12 months ago

0.0.36

12 months ago

0.0.35

12 months ago

0.0.34

12 months ago

0.0.33

12 months ago

0.0.32

12 months ago

0.0.31

12 months ago

0.0.30

12 months ago

0.0.29

12 months ago

0.0.28

12 months ago

0.0.27

12 months ago

0.0.26

12 months ago

0.0.25

12 months ago

0.0.24

12 months ago

0.0.23

12 months ago

0.0.22

12 months ago

0.0.21

12 months ago

0.0.20

12 months ago

0.0.19

12 months ago

0.0.18

12 months ago

0.0.17

1 year ago

0.0.16

1 year ago