npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@structures/array-list

v0.1.3

Published

ArrayList Data Structure

Readme

Classes

Constants

ArrayList

Class storing elements in contiguous memory. Allows precise control over resizing strategy. Note: In most cases, the built-in JS Array will outperform this structure due to internal optimizations.

Kind: global class

new ArrayList([initialCapacity], [resizeStrategy])

Creates a new ArrayList

| Param | Type | Default | Description | | --- | --- | --- | --- | | [initialCapacity] | number | DEFAULT_INITIAL_CAPACITY | Initial array capacity before resize required. | | [resizeStrategy] | function | DEFAULT_RESIZE_STRATEGY | Function to resize array after capacity met. |

arrayList.add(...elements) ⇒ ArrayList

Adds the passed elements to the list.

Kind: instance method of ArrayList
Returns: ArrayList - - This

| Param | Type | Description | | --- | --- | --- | | ...elements | * | Elements to be added. |

arrayList.addAll(iterable) ⇒ ArrayList

Adds each element in the passed array to the list.

Kind: instance method of ArrayList
Returns: ArrayList - - This
Throws:

  • Error Will throw if iterable does not implement iterable protocol.

| Param | Type | Description | | --- | --- | --- | | iterable | Array | Iterable containing the elements to be added. |

arrayList.clear() ⇒ ArrayList

Clears all elements from the list.

Kind: instance method of ArrayList
Returns: ArrayList - - This

arrayList.contains(element, [comparator]) ⇒ boolean

Checks if an element exists within the list, with the comparator if passed.

Kind: instance method of ArrayList
Returns: boolean - - Returns true if element exists, false if not.

| Param | Type | Description | | --- | --- | --- | | element | * | The element to check existence. | | [comparator] | function | The function used to compare two elements. |

arrayList.get(index) ⇒ *

Returns the element at the specified index.

Kind: instance method of ArrayList
Returns: * - - Returns the element at the index given.
Throws:

  • Error - Will throw if |index| is out of bounds for this list.

| Param | Type | Description | | --- | --- | --- | | index | number | The index to retrieve an element from. Negatives allowed. |

arrayList.indexOf(element, [comparator]) ⇒ number

Returns the index of the element, or -1 if it is not in the list.

Kind: instance method of ArrayList
Returns: number - - Returns the index of the element, or else -1.

| Param | Type | Description | | --- | --- | --- | | element | * | The element to retrieve the index of. | | [comparator] | function | The function used to compare two elements. |

arrayList.insert(index, element) ⇒ ArrayList

Inserts the element at the specified index, shifting remaining elements down.

Kind: instance method of ArrayList
Returns: ArrayList - - This
Throws:

  • Error - Will throw if |index| is out of bounds for this list.

| Param | Type | Description | | --- | --- | --- | | index | number | The index to insert the element at. Negatives allowed. | | element | * | The element to insert. |

arrayList.isEmpty() ⇒ boolean

Returns true if the list has no elements, or else false.

Kind: instance method of ArrayList
Returns: boolean - - Whether or not this list is empty

arrayList.remove(index) ⇒ *

Removes the element from the list, shifting remaining elements, and returns it.

Kind: instance method of ArrayList
Returns: * - - The element that was removed.
Throws:

  • Error - Will throw if |index| is out of bounds for this list.

| Param | Type | Description | | --- | --- | --- | | index | number | The index of the element to remove. Negatives allowed. |

arrayList.set(index, elemnet) ⇒ *

Replaces the element at the specified index.

Kind: instance method of ArrayList
Returns: * - - The element that was replaced.
Throws:

  • Error - Will throw if |index| is out of bounds for this list.

| Param | Type | Description | | --- | --- | --- | | index | number | The index of the element to replace. Negatives allowed. | | elemnet | * | The element to place in the list. |

arrayList.size() ⇒ number

Returns the current number of elements in the list.

Kind: instance method of ArrayList
Returns: number - - The current list size.

arrayList.toString() ⇒ string

Returns a string representation of this list.

Kind: instance method of ArrayList
Returns: string - - The string representation of this list.

arrayList.iterator() ⇒ iterator

Returns an object that implements the iterator protocol.

Kind: instance method of ArrayList
Returns: iterator - - An iterator for the list. Not access safe.

DEFAULT_INITIAL_CAPACITY

Kind: global constant
Default: 8

DEFAULT_RESIZE_STRATEGY

Kind: global constant
Default: - Doubles array capacity once limit is reached