Options
All
  • Public
  • Public/Protected
  • All
Menu

Module Utils

Miscellaneous utilities

Index

Type aliases

Writeable

Writeable<T>: {}

Type parameters

  • T

Type declaration

Variables

Let katex

katex: any = null

Functions

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

Const gcd

  • gcd(a: number, b: number): number
  • Greatest Common Denominator

    Uses the faster division-based version of Euclid's algorithm.

    Parameters

    • a: number
    • b: number

    Returns number

idGen

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

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

    Returns string

range

  • range(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

Generated using TypeDoc