New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

object-set-type

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-set-type

A Set implementation which supports Objects.

  • 2.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17K
decreased by-18.84%
Maintainers
1
Weekly downloads
 
Created
Source

object-set-type

Downloads Version@npm Version@git CI Docs

A Set implementation that supports Objects and custom conditions.

Usage

const ObjectSet = require('object-set-type');

const set = new ObjectSet();
set.add(1);
set.add('Hello');
set.add({
    a: 1
});
set.add({
    a: 1
});

console.log(set.size); // 3
Array.from(set); // 1, "Hello", {a: 1}

Custom comparison logic

The equals(a,b) method is responsible for comparing two items, and the set logic is based on this. This method can be overwritten to support custom uniqueness logic, e.g., handle objects, but compare only specific properties.

Documentation

For detailed documentation see the TypeDocs documentation.

Keywords

FAQs

Package last updated on 27 Jul 2023

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