Socket
Book a DemoInstallSign in
Socket

@bearclaw/collections

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bearclaw/collections

This library is a set of TypeScript classes and functions for working with collections of data.

0.1.1
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
0
Weekly downloads
 
Created
Source

collections

This library is a set of TypeScript classes and functions for working with collections of data.

HashMap

An extension of the built-in Map object that uses a hashing function for key equality. Unlike the built-in Map object, it will treat objects with identical values as equal. To illustrate this difference, this is how the built-in Map treats objects:

const map = new Map()
map.set({}, 'abc')
map.get({}) // Will return undefined
map.has({}) // Will return false

In contrast, HashMap will treat them like so:

const map = new HashMap()
map.set({}, 'abc')
map.get({}) // Will return `'abc'`
map.has({}) // Will return true

HashSet

An extension of the built-in Set object that uses a hashing function for value equality. Unlike the built-in Set object, it will treat identical object values as equal. To illustrate this difference, this is how the built-in Set treats objects:

const set = new Set()
map.add({})
map.has({}) // Will return false

In contrast, HashSet will treat them like so:

const set = new HashSet()
map.add({})
map.has({}) // Will return true

Running unit tests

Run nx test collections to execute the unit tests via Jest.

FAQs

Package last updated on 17 Dec 2024

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.