Options
All
  • Public
  • Public/Protected
  • All
Menu

Module Utils

Miscellaneous utilities

Index

Type aliases

FlatGen

FlatGen<A, D>: any

Type parameters

  • A

  • D

Genable

Genable<T>: Generator<T> | Iterator<T> | Iterable<T>

Type parameters

  • T

Writeable

Writeable<T>: {}

Type parameters

  • T

Type declaration

Variables

Const GenProto

GenProto: any = Object.getPrototypeOf(Foo())

Let katex

katex: any = null

Functions

Foo

  • Foo(): Generator<never, void, unknown>

Const NYI

  • NYI(name?: undefined | string): never
  • Convenience function for marking places not yet implemented.

    Parameters

    • Optional name: undefined | string

      Optional name for what is not implemented yet.

    Returns never

Const Throw

  • Throw(msg?: string): never
  • A functional version of the throw statement.

    Parameters

    • Default value msg: string = "Error"

    Returns never

Const callSite

  • callSite(s: string | string[]): any
  • Coerce a string into a form suitable for passing to a string interpolator.

    Parameters

    • s: string | string[]

    Returns any

curry1

  • curry1<R, A>(f: (a: A) => R): Function1<R, A>
  • Type parameters

    • R

    • A

    Parameters

    • f: (a: A) => R
        • (a: A): R
        • Parameters

          • a: A

          Returns R

    Returns Function1<R, A>

curry2

  • curry2<R, A, B>(f: (a: A, b: B) => R): Function2<R, A, B>
  • Take a function of two arguments, and return one that auto-curries. If any of the arguments is undefined, return a function that accepts that argument.

    If both arguments are undefined, returns itself. If both arguments are defined, immediately calls f with those arguments if a is undefined, return a => f(a, b) if b is undefined, return b => f(a, b)

    Type parameters

    • R

    • A

    • B

    Parameters

    • f: (a: A, b: B) => R

      a function of two arguments.

        • (a: A, b: B): R
        • Parameters

          • a: A
          • b: B

          Returns R

    Returns Function2<R, A, B>

curry3

  • curry3<R, A, B, C>(f: (a: A, b: B, c: C) => R): Function3<R, A, B, C>
  • Take a function of three arguments, and return one that auto-curries. If any of the arguments are undefined, return a function that accepts that argument.

    If all arguments are undefined, returns itself. If all arguments are defined, immediately calls f with those arguments if a is undefined, return a => f(a, b, c) if b is undefined, return b => f(a, b, c) if c is undefined, return c => f(a, b, c)

    Type parameters

    • R

    • A

    • B

    • C

    Parameters

    • f: (a: A, b: B, c: C) => R

      a function of three arguments.

        • (a: A, b: B, c: C): R
        • Parameters

          • a: A
          • b: B
          • c: C

          Returns R

    Returns Function3<R, A, B, C>

curry4

  • curry4<R, A, B, C, D>(f: (a: A, b: B, c: C, d: D) => R): Function4<R, A, B, C, D>
  • Take a function of four arguments, and return one that auto-curries. If any of the arguments are undefined, return a function that accepts that argument.

    If all arguments are undefined, returns itself. If all arguments are defined, immediately calls f with those arguments if a is undefined, return a => f(a, b, c, d) if b is undefined, return b => f(a, b, c, d) if c is undefined, return c => f(a, b, c, d) if d is undefined, return d => f(a, b, c, d)

    Type parameters

    • R

    • A

    • B

    • C

    • D

    Parameters

    • f: (a: A, b: B, c: C, d: D) => R

      a function of four arguments.

        • (a: A, b: B, c: C, d: D): R
        • Parameters

          • a: A
          • b: B
          • c: C
          • d: D

          Returns R

    Returns Function4<R, A, B, C, D>

Const defineTag

  • defineTag(proto: Constructor<any, any> | any, tag: string): void
  • Define a @toStringTag for a given class's prototype so that objects show in inspectors with that tag even if minified. Can accept either a prototype or a class constructor.

    Parameters

    Returns void

idGen

  • idGen(prefix?: string, sep?: string): string
  • Parameters

    • Default value prefix: string = "gen"
    • Default value sep: string = "-"

    Returns string

Const isFunction

  • isFunction<A>(f: any): f is A

Const isGenerator

  • isGenerator(g: any): g is Generator

Const isIterable

  • isIterable<K>(i: Iterable<K> | any): i is Iterable<K>
  • Type parameters

    • K

    Parameters

    • i: Iterable<K> | any

    Returns i is Iterable<K>

Const isIterator

  • isIterator<K>(i: Iterable<K> | any): i is Iterator<K>
  • Type parameters

    • K

    Parameters

    • i: Iterable<K> | any

    Returns i is Iterator<K>

Const itEvery

  • itEvery<T>(it: Iterator<T>, p: (v: T, idx: number) => boolean, thisArg?: any): boolean
  • Type parameters

    • T

    Parameters

    • it: Iterator<T>
    • p: (v: T, idx: number) => boolean
        • (v: T, idx: number): boolean
        • Parameters

          • v: T
          • idx: number

          Returns boolean

    • Optional thisArg: any

    Returns boolean

Const itReduce

  • itReduce<T, A>(it: Iterator<T>, f: (acc: A | T, v: T) => A, init?: A): A
  • Type parameters

    • T

    • A

    Parameters

    • it: Iterator<T>
    • f: (acc: A | T, v: T) => A
        • (acc: A | T, v: T): A
        • Parameters

          • acc: A | T
          • v: T

          Returns A

    • Optional init: A

    Returns A

Const itSome

  • itSome<T>(it: Iterator<T>, p: (v: T, idx: number) => boolean, thisArg?: any): boolean
  • Type parameters

    • T

    Parameters

    • it: Iterator<T>
    • p: (v: T, idx: number) => boolean
        • (v: T, idx: number): boolean
        • Parameters

          • v: T
          • idx: number

          Returns boolean

    • Optional thisArg: any

    Returns boolean

Const not

  • not<T>(pred: (a: T) => boolean): (a: T) => boolean
  • Return the negation of a predicate.

    Type parameters

    • T

    Parameters

    • pred: (a: T) => boolean
        • (a: T): boolean
        • Parameters

          • a: T

          Returns boolean

    Returns (a: T) => boolean

      • (a: T): boolean
      • Parameters

        • a: T

        Returns boolean

Const range

  • Parameters

    • Default value start: number = 0
    • Default value end: number = Number.MAX_SAFE_INTEGER
    • Default value step: number = 1

    Returns MappableGenerator<number>

range2

  • range2(start?: number, end?: number, step?: number): Generator<number, void, unknown>
  • Parameters

    • Default value start: number = 0
    • Default value end: number = Number.MAX_SAFE_INTEGER
    • Default value step: number = 1

    Returns Generator<number, void, unknown>

Const romberg

  • romberg(f: (n: number) => number, a: number, b: number, max_steps: number, acc: number): number
  • Parameters

    • f: (n: number) => number
        • (n: number): number
        • Parameters

          • n: number

          Returns number

    • a: number
    • b: number
    • max_steps: number
    • acc: number

    Returns number

Const tex

  • tex(s: TemplateStringsArray, ...substitutions: any[]): string
  • Parameters

    • s: TemplateStringsArray
    • Rest ...substitutions: any[]

    Returns string

toGenerator

  • toGenerator<T>(i: Genable<T>): Generator<T>

toIterable

  • toIterable<T>(i: Genable<T>): Iterable<T>

toIterator

  • toIterator<T>(i: Genable<T>): Iterator<T>

Generated using TypeDoc