Skip to content

A library of lazy, efficient, generic collections for TypeScript.

Notifications You must be signed in to change notification settings

jyuhuan/collection-ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Collection.ts

🚧 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. 🌹

Features

  • 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 type K) and a hashing strategy (a Hash<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 on ArraySeq will not return another ArraySeq (as in Scala), or merely Iterable (as in C#). It will return RandomAccessSeq, which is the most fine-grained abstract class possible for ArraySeqs. 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 the Iterable class in Collection.ts implements the Iterable of JavaScript ensures that a user can operate on Collection.ts structures in the most natural way.

Compatibility

Collection.ts is written with TypeScript 2.2.1.

About

A library of lazy, efficient, generic collections for TypeScript.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published