@agyemanjp/standard

Standard library for JavaScript/TypeScript

Usage no npm install needed!

<script type="module">
  import agyemanjpStandard from 'https://cdn.skypack.dev/@agyemanjp/standard';
</script>

README

standard.js

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, Dictionary, and DataTable
  • 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.
  • HTTP communication functionality
  • Advanced string, date-time, and numeric functions
  • Utility types, type guards, and value helpers

Install

npm install --save @agyemanjp/standard

Usage

// import specific functions from specific modules
import { mapAsync, ZipAsync, isAsyncIterable /*, ...*/ } from "@agyemanjp/standard/collections/combinators"
import { keys, entries, pick, omit  /*, ...*/ } from "@agyemanjp/standard/object"
import { sleep, promisify } from "@agyemanjp/standard/async"

// import everything from a module
import * as containers from "@agyemanjp/standard/collections/containers"
const numArray = new containers.Array([1, 2, 3])

// import everything from package
import * as stdlib from "@agyemanjp/standard"
type Predicate<T> = stdlib.Predicate<T>