Socket
Book a DemoInstallSign in
Socket

fancy-set

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fancy-set

Constrained mixin that applies set-theoretic operations to set classes

latest
Source
npmnpm
Version
0.1.6
Version published
Maintainers
1
Created
Source

fancy-set

Constrained mixin that applies set-theoretic operations to set classes.

Installation

pnpm add fancy-set

Usage

Fancified versions of the native set class can be directly imported:

import { FancySet } from "fancy-set";

const myFancySet = new FancySet([1, 2, 3]);
const mySuperFancySet = new FancySet([1, 2, 3, 4, 5]);

mySuperFancySet.isSuperset(myFancySet); // true

TypeScript support

This module ships its own type definitions, so TypeScript is supported out of the box.

Custom sets

The fancify mixin can be applied to custom set implementations:

import { fancify } from "fancy-set";

class MyCustomSet extends Set {
  /** ... */
}
const MyFancyCustomSet = fancify(MyCustomSet);

Alternatively, custom set implementations can be derived from fancy sets:

import { fancify, FancySet } from "fancy-set";

class MyFancyCustomSet extends fancify(Set) {
  /** ... */
}
// or
class MyFancyCustomSet extends FancySet {
  /** ... */
}

Keywords

set

FAQs

Package last updated on 22 Apr 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