This package has been deprecated

Author message:

ES2025 brings enhancements to the native Set class. While not equivalent, the added methods are enough to cover most set theory needs.

fancy-set
TypeScript icon, indicating that this package has built-in type declarations

0.1.6 • Public • Published

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 {
  /** ... */
}

Package Sidebar

Install

npm i fancy-set

Weekly Downloads

4

Version

0.1.6

License

MIT

Unpacked Size

8.04 kB

Total Files

5

Last publish

Collaborators

  • driimus