Options
All
  • Public
  • Public/Protected
  • All
Menu

This module is used to keep all the useful DRY code that can be called at any time from anywhere in the project.

For more specific method calls you might want to look in the other util files listed below

  • Strings
  • Files
  • MemberUtil
  • Logger
  • ImageUtil
  • ChannelUtil

Calling this class:

import * from 'path-to-this-file'

Hierarchy

  • Util

Index

Constructors

Methods

  • groupBy<K, V>(list: Collection<string, V> | V[] | Map<string, V>, keyGetter: (input: V) => K): Map<K, V[]>
  • Groups items in a list based on a common-matched value.

    Type parameters

    • K

      Is generally intended to be a property of V.

    • V

      List of items

    Parameters

    • list: Collection<string, V> | V[] | Map<string, V>

      The list of items

    • keyGetter: (input: V) => K

      The command-matched value to index from

        • (input: V): K
        • Parameters

          • input: V

          Returns K

    Returns Map<K, V[]>

    Map of the grouped arrays

  • isBoolean(str: string): string | boolean
  • Checks if string is a boolean.

    Parameters

    • str: string

      The value to be checked.

    Returns string | boolean

    If the value was a boolean.

  • isEmpty(val: any): boolean
  • Checks if something is empty as in if their size/length is 0.

    Parameters

    • val: any

      The value to be checked if empty.

    Returns boolean

    Whether it is empty or not.

  • isPromise(val: any): boolean
  • Checks if something is a promise.

    Parameters

    • val: any

      The value to be checked.

    Returns boolean

    If the value was a promise.