Skip to content

Latest commit

 

History

History
43 lines (31 loc) · 5.16 KB

polyethylene.md

File metadata and controls

43 lines (31 loc) · 5.16 KB

Home > polyethylene

polyethylene package

A library for working with iterables and async iterables in a functional style, by transforming the iterations on the fly and getting results from them.

Remarks

The entry point for this library is the Poly namespace, and the main iterable classes are PolySyncIterable and

Classes

Class Description
AsyncIterableBuilder A class that helps with building an from a non-structured source.In order to create the iteration, you must call the , and methods with appropriate arguments.
PolyAsyncIterable An AsyncIterable<T> with a suite of methods for transforming the iteration into other iterations or to get a single result from it.This class works as an async version of PolySyncIterable, but all methods accept async function where possible and will always return either PolyAsyncIterables or a Promise to a value.
PolySyncIterable A SyncIterable<T> with a suite of methods for transforming the iteration into other iterations or to get a single result from it.The methods of this class are intended to resemble those of Array, with added utilities where appropriate and made for any kind of iterable.

Namespaces

Namespace Description
Poly Main namespace for the creation of PolySyncIterable and PolyAsyncIterable objects.

Type Aliases

Type Alias Description
AsyncChunkingPredicate A function that receives an element (elem) of the iteration and the first and last element of a chunk, and returns a boolean value or a Promise to a boolean value representing whether elem should be added to the current chunk (if true) or be the start of a new chunk (if false)
AsyncIndexedMapping A function that receives an object (elem) and its index in the iteration and returns a different object or a Promise to a different object
AsyncIndexedPredicate A function that receives an object (elem) and its index in the iteration and returns a boolean value or a Promise to a boolean value.
AsyncIndexedReducer A function that receives an accumulated result, an element of an iteration, and returns a new accumulated result or a promise to a new accumulated result for the next call or as a final return value.
AsyncIndexedRunnable A function that receives an object (elem) and its index in the iteration and either returns a Promise to nothing or doesn't return anything
ChunkingPredicate A function that receives an element (elem) of the iteration and the first and last element of a chunk, and returns a boolean value representing whether elem should be added to the current chunk (if true) or be the start of a new chunk (if false)
Comparator A function that receives two objects elemA and elemB and returns a number value that is negative if elemA should be sorted before elemB, positive if elemA should be sorted after elemB, or 0 if they should be sorted at the same position.
IndexedMapping A function that receives an object (elem) and its index in the iteration and returns a different object
IndexedPredicate A function that receives an object (elem) and its index in the iteration and returns a boolean value.
IndexedReducer A function that receives an accumulated result, an element of an iteration, and returns a new accumulated result for the next call or as a final return value.
IndexedRunnable A function that receives an object (elem) and its index in the iteration and doesn't return anything
IndexedTypePredicate A function that receives an object (elem) and its index in the iteration and returns a boolean value indicating if elem is of the generic type U