Home Manual Reference Source

Overview

Installation

Can be managed using yarn, npm, or jspm.

yarn

yarn add @collection-abstraction/set

npm

npm install @collection-abstraction/set --save

jspm

jspm install npm:@collection-abstraction/set

Usage

:warning: Depending on your environment, the code may require regeneratorRuntime to be defined, for instance by importing regenerator-runtime/runtime.

First, require the polyfill at the entry point of your application

await import('regenerator-runtime/runtime.js');
// or
import 'regenerator-runtime/runtime.js';

Then, import the library where needed

const {set} = await import('@collection-abstraction/set');
// or
import {set} from '@collection-abstraction/set';

Examples

See Python's docs:

Some changes w.r.t. Python's API

set

set( iterable = null ) -> this

set.inclusion( A , B ) -> {-1,0,1}

set.prototype[Symbol.iterator]( ) -> iterable

set.prototype.keys( ) -> iterable

set.prototype.len( ) -> integer

set.prototype.has( key ) -> boolean

set.prototype.isdisjoint( other ) -> boolean

set.prototype.isequal( other ) -> boolean

set.prototype.issubset( other ) -> boolean

set.prototype.ispropersubset( other ) -> boolean

set.prototype.issuperset( other ) -> boolean

set.prototype.ispropersuperset( other ) -> boolean

set.prototype.union( ...others ) -> set

set.prototype.intersection( ...others ) -> set

set.prototype.difference( ...others ) -> set

set.prototype.symmetric_difference( other ) -> set

set.prototype.copy( ) -> set

set.prototype.update( ...others ) -> this

set.prototype.intersection_update( ...others ) -> this

set.prototype.difference_update( ...others ) -> this

set.prototype.symmetric_difference_update( other ) -> this

set.prototype.add( key ) -> this

set.prototype.remove( key ) -> this

set.prototype.discard( key ) -> this

set.prototype.pop( ) -> key

set.prototype.clear( ) -> this