🚧 Ongoing Active Development
See usages in the Wiki. Check out what has been implemented so far and what's to come in the roadmap.
Collection.ts is a collection framework providing lazy, efficient, and generic collections for TypeScript.
Collection.ts cannot exist without the Poly-collection framework on Scala. 🌹
-
Hash map and hash sets (and other keyed/hashed structures) support custom classes, as long as an equivalence strategy (an
Eq<K>
for the key typeK
) and a hashing strategy (aHash<K>
) are provided. A related interface,Ord<K>
, is provided for custom ordering definitions. -
Almost all higher-order functions (e.g.,
map
,flatMap
,filter
,reduce
, ...) are lazy. This means that these transformations only define (instead of create) a new collection. No actual computation will happen until the elements in the new collection are accessed. -
The higher-order functions return the most specific abstract type possible sa their results. For example, a
map
operation onArraySeq
will not return anotherArraySeq
(as in Scala), or merelyIterable
(as in C#). It will returnRandomAccessSeq
, which is the most fine-grained abstract class possible forArraySeq
s. This is an idea borrowed from Poly-collection. -
Easy conversion between Collection.ts collections and TypeScript/JavaScript collections. This allows easy integration with any current project.
-
TypeScript/JavaScript
for of
support. The fact that theIterable
class in Collection.ts implements theIterable
of JavaScript ensures that a user can operate on Collection.ts structures in the most natural way.
Collection.ts is written with TypeScript 2.2.1.