standard.js
A standard library for JavaScript/TypeScript
Features
- Lazy iterable combinators such as map, filter, reduce, etc.
- Lazy async iterable combinators such as mapAsync, filterAsync, etc.
- Fluent iterable containers: Sequence, Set, Array, ArrayNumeric, Dictionary
- Functional combinators such as flip, curry, etc.
- Async combinators such as promisify, sleep, etc.
- Statistical functions such as mean, median, quartiles, variance/standard deviation, etc.
- Advanced string, date-time, and numeric functions
- Utility types, type guards, and value helpers
Install
npm install --save @sparkwave/standard
Usage
// import specific functions from specific modules
import { mapAsync, ZipAsync, isAsyncIterable /*, ...*/ } from "@sparkwave/standard/collections/combinators"
import { keys, entries, pick, omit /*, ...*/ } from "@sparkwave/standard/object"
import { sleep, promisify } from "@sparkwave/standard/async"
// import everything from a module
import * as containers from "@sparkwave/standard/collections/containers"
const numArray = new containers.Array([1, 2, 3])
// import everything from package
import * as stdlib from "@sparkwave/standard"
type Predicate<T> = stdlib.Predicate<T>