Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/source_map/lib/array-set.js>default

Port of mozilla / source-map to deno.
Latest
class default
import { default } from "https://deno.land/x/source_map@0.8.0-beta.1/lib/array-set.js";

A data structure which is a combination of an array and a set. Adding a new member is O(1), testing for membership is O(1), and finding the index of an element is O(1). Removing elements from the set is not supported. Only strings are supported for membership.

Constructors

new
default()

Methods

add(aStr, aAllowDuplicates)

Add the given string to this set.

at(aIdx)

What is the element at the given index?

has(aStr)

Is the given string a member of this set?

indexOf(aStr)

What is the index of the given string in the array?

Return how many unique items are in this ArraySet. If duplicates have been added, than those do not count towards the size.

Returns the array representation of this set (which has the proper indices indicated by indexOf). Note that this is a copy of the internal array used for storing the members so that no one can mess with internal state.

Static Methods

fromArray(aArray, aAllowDuplicates)

Static method for creating ArraySet instances from an existing array.