Skip to main content
Module

x/rimbu/multiset/README.md

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
File

@rimbu/multiset

A Rimbu MultiSet is a Set-like structure where each unique element can be added multiple times. Each element in the MultiSet occurs one or more times. The MultiSet keeps track of the amount of times an element was added.

This package exports the following main types:

Name Description
HashMultiSet<T> a MultiSet with hashed elements of type T
MultiSet<T> a generic MultiSet with elements of type T
SortedMultiSet<T> a MultiSet with sorted elements of type T
VariantMultiSet<T> a type-variant MultiSet with elements of type T

For complete documentation please visit the Rimbu Docs.

Or Try Me Out in CodeSandBox.

Installation

All types are exported through @rimbu/core. It is recommended to use this package.

To install separately:

yarn add @rimbu/multiset

or

npm i @rimbu/multiset

Rimbu uses advanced and recursive typing, potentially making the TypeScript compiler quite slow in some cases, or causing infinite recursion. It is recommended to set the following values in the tsconfig.json file of your project:

{
  "compilerOptions": {
    "skipLibCheck": true,
    "noStrictGenericChecks": true
  }
}

Usage

import { SortedMultiSet } from '@rimbu/multiset';

console.log(SortedMultiSet.of(1, 3, 2, 3, 2, 3).toString());

Author

Arvid Nicolaas

Contributing

Feel very welcome to contribute to further improve Rimbu. Please read our Contributing guide.

Contributors

Made with contributors-img.

License

Licensed under the MIT License, Copyright © 2020-present Arvid Nicolaas.

See LICENSE for more information.