Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "utils"

file

Various utilities that don't belong anywhere else.

author

Nathan Pennie kb1rd@kb1rd.net

Index

Variables

Const BreakException

BreakException: {}

Type declaration

Functions

allKeys

  • allKeys<T, K>(obj: T): K[]
  • Type parameters

    • T

    • K: keyof T

    Parameters

    • obj: T

    Returns K[]

allValues

  • allValues<T, V>(obj: T): V[]
  • Type parameters

    • T

    • V: T[keyof T]

    Parameters

    • obj: T

    Returns V[]

arraymap

  • arraymap<T>(array: T[], fn: (el: T) => T[]): T[]
  • Like the built-in map function, but it replaces the element with an arbitrary number of elements, making it a combination of map, push, and filter.

    Type parameters

    • T

      The type of the array elements.

    Parameters

    • array: T[]

      The array to map. It will be modified.

    • fn: (el: T) => T[]

      The element mapper function. It takes the current element as an argument and returns the element(s) take its place.

        • (el: T): T[]
        • Parameters

          • el: T

          Returns T[]

    Returns T[]

    The same array that was passed as an argument.

catchBreak

  • catchBreak(fn: () => void): void
  • Parameters

    • fn: () => void
        • (): void
        • Returns void

    Returns void

Generated using TypeDoc