Options
All
  • Public
  • Public/Protected
  • All
Menu

Module Utils

Miscellaneous utilities

Index

Type aliases

Writeable

Writeable<T>: {}

Removes the readonly property from the fields of an object type.

typeparam

object type to remove readonly from.

Type parameters

  • T

Type declaration

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

idGen

  • idGen(prefix?: string, sep?: string): string
  • Generate a unique ID based on a prefix. A different numerical series is produced for each prefix.

    Parameters

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

    Returns string

Const isFunction

  • isFunction<A>(f: any): f is A
  • Predicate/Type Guard for any function.

    Type parameters

    Parameters

    • f: any

    Returns f is A

Const not

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

    Type parameters

    • T: Array<any>

    Parameters

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

          • Rest ...a: T

          Returns boolean

    Returns (...a: T) => boolean

      • (...a: T): boolean
      • Parameters

        • Rest ...a: T

        Returns boolean

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
  • String template for producing tex. Produces a raw string containing the LaTeX code, unparsed. If the katex module is available, it will be used to parse the LaTeX for error-checking purposes, but the string will be returned (suitable for later parsing in the end environment).

    Parameters

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

    Returns string

Generated using TypeDoc