Options
All
  • Public
  • Public/Protected
  • All
Menu

Module Utils

Miscellaneous utilities

preferred

Index

Type aliases

Writeable

Writeable<T>: {-readonly [ P in keyof T]-?: T[P] }

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

typeparam

object type to remove readonly from.

Type parameters

  • T

Functions

Const NYI

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

    Parameters

    • Optional name: string

      Optional name for what is not implemented yet.

    Returns never

Const Throw

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

    Parameters

    • msg: string | Error = '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

Const defineTag

  • defineTag(proto: 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

    • proto: any
    • tag: string

    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

    • prefix: string = 'gen'
    • sep: string = '-'

    Returns string

Const isFunction

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

    Type parameters

    • A: Function

    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: 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 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