0.1.6 • Published 1 year ago

fancy-set v0.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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

1 year ago

0.1.4

2 years ago

0.1.5

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago