@dragiyski/collection
v2.0.1
Published
A library with helper collection classes
Downloads
2
Readme
This module contains extended collection in addition to existing ECMAScript collections:
OrderedSet
is a collection similar toSet
, but with a guaranteed order and indexing.OrderedMap
is a collection similar toMap
, but with a guaranteed order and indexing.Implementation
is a collection that can associate interfaces to their relevant implementation. The collection is similar toSymbol
primitive, but it does not modify the interface objects - no string or symbol properties are added to that object. A symbol is added to the implementation object to link back the interface.WeakOrderedSet
is a collection loosly similar toOrderedSet
andArray
, but objects assigned to this collection are hold by weak references and can be garbage collected. LikeWeakSet
the collection can only store objects (not primitives), but maintains the order of the objects inside. Indexing is not supported for this collection.
Installation
To install this module, run:
npm install @dragiyski/collection
Usage
To use this module, use either shorthand syntax:
const { OrderedSet, OrderedMap } = require('@dragiyski/collection');
or include specific collection by filename:
const OrderedSet = require('@dragiyski/collection/ordered-set');
All filenames use dash-case.