Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

allocated-dynamic-typedarray

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

allocated-dynamic-typedarray

A typed array whose length() can change.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

allocated-dynamic-typedarray

Allocate an entire array, but automatically track which indices are occupied.

Example

var ADTA = require('allocated-dynamic-typedarray');

var a = new ADTA(64); // maximum size is 64, defaults to Uint32Array
a.length(); // 0
a.push(72);
a.length(); // 1
a.get(0); // 72
a.push(23);
a.push(34);
a.push(56);
a.length() // 4
a.remove(1);
a.length(); // 3
a.toArray(); // [72,56,34]

Notice how the order of the items is not guaranteed after a .remove(). This is to prevent needing to shift or push all values. If you need functionality otherwise, try a different module.

Pushing a value that would cause the array to exceed it's initial limit silently fails for now, as that's why TypedArrays do.

Since this is backed by a TypedArray, only values that could normally be stored in a TypedArray will succeed.

Contributing

npm test

Pull requests are welcome!

License

MIT

Keywords

FAQs

Package last updated on 21 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc