Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "utils"

file

Various utilities that don't belong anywhere else.

author

Nathan Pennie kb1rd@kb1rd.net

Index

Type aliases

CompareFunction

CompareFunction<T>: function

A function type that takes T and returns a CompareResult.

Type parameters

  • T

Type declaration

CompareResult

CompareResult: -1 | 0 | 1

One of zero, one, or negative one.

DualCompareFunction

DualCompareFunction<T>: function

A function type that takes two of a type T and returns a CompareResult.

Type parameters

  • T

Type declaration

Functions

arraymap

  • arraymap<T>(array: T[], fn: function): 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.

    template

    T - The type of the array elements.

    Type parameters

    • T

    Parameters

    • array: T[]

      The array to map. It will be modified.

    • fn: function

      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.

Generated using TypeDoc