Options
All
  • Public
  • Public/Protected
  • All
Menu

@alterior/common

Index

Type aliases

BaseError

BaseError: BaseErrorT | Error

ColorLibrary

ColorLibrary<T>: {}

Type parameters

  • T

Type declaration

Variables

Const BASE64_KEY

BASE64_KEY: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="

Const ConsoleColors

ConsoleColors: {} = objectLibrary(CONSOLE_COLORS)

Provides methods for colorizing strings

Type declaration

Const EXPOSE_PROTOTYPE_STORAGE_KEY

EXPOSE_PROTOTYPE_STORAGE_KEY: "@sliptap/backend:Expose" = "@sliptap/backend:Expose"

Functions

Expose

Injectable

  • Injectable(): (Anonymous function)

clone

  • clone<T>(obj: T): T
  • Perform a standard clone using serialization (see cloneBySerialization)

    Type parameters

    • T

    Parameters

    • obj: T

    Returns T

cloneBySerialization

  • cloneBySerialization(obj: any): any

coalesce

  • coalesce(...values: any[]): any

deepClone

  • deepClone(o: any): any
  • Deeply clone the given value. If the value is an object, all subobjects are deeply cloned as well.

    Parameters

    • o: any

    Returns any

formatConsole

  • formatConsole(formatter: (message: string) => string, callback: Function): void
  • Intercept all console messages emitted within the given function and format them using the given formatter before printing them.

    Parameters

    • formatter: (message: string) => string
        • (message: string): string
        • Parameters

          • message: string

          Returns string

    • callback: Function

    Returns void

getParameterNames

  • getParameterNames(fn: any): string[]

indentConsole

  • indentConsole(spaces: number, callback: Function): void
  • Intercept all console messages emitted within the given function and indent them with the given number of spaces before printing them out.

    Parameters

    • spaces: number
    • callback: Function

    Returns void

interceptConsole

  • interceptConsole(handler: (method: string, originalImpl: Function, console: Console, args: any[]) => void, callback: Function): void
  • Intercept console messages emitted within the given function, allowing you to programmatically call the underlying raw console implementation (or not).

    Parameters

    • handler: (method: string, originalImpl: Function, console: Console, args: any[]) => void
        • (method: string, originalImpl: Function, console: Console, args: any[]): void
        • Parameters

          • method: string
          • originalImpl: Function
          • console: Console
          • args: any[]

          Returns void

    • callback: Function

    Returns void

interval

  • interval(time: number): Observable<void>
  • Return an observable that fires at regular intervals as long as it has subscribers. To stop the interval, remove all subscribers.

    Parameters

    • time: number

    Returns Observable<void>

lazySubject

  • Utility for creating a subject observable which can run arbitrary code when the first subscribe() happens and when the last unsubscribe() happens.

    Type parameters

    • T

    Parameters

    Returns Observable<T>

objectLibrary

prepareForSerialization

  • prepareForSerialization<T>(data: T): T
  • Prepare an object for serialization by removing any fields which are undefined or functions and return the result. The operation is recursive across all subobjects. The original object is not modified.

    Type parameters

    • T

    Parameters

    • data: T

    Returns T

shallowClone

  • shallowClone(obj: Object): any
  • Perform a shallow clone of the object, producing one that has the same constructor chain and prototype as the passed object.

    Parameters

    • obj: Object

    Returns any

timeout

  • timeout(time?: number): Promise<void>

Object literals

Const CONSOLE_COLORS

CONSOLE_COLORS: object

bgBlack

bgBlack: number[] = [40, 49]

bgBlue

bgBlue: number[] = [44, 49]

bgCyan

bgCyan: number[] = [46, 49]

bgGreen

bgGreen: number[] = [42, 49]

bgMagenta

bgMagenta: number[] = [45, 49]

bgRed

bgRed: number[] = [41, 49]

bgWhite

bgWhite: number[] = [47, 49]

bgYellow

bgYellow: number[] = [43, 49]

black

black: number[] = [30, 39]

blue

blue: number[] = [34, 39]

bold

bold: number[] = [1, 22]

cyan

cyan: number[] = [36, 39]

dim

dim: number[] = [2, 22]

gray

gray: number[] = [90, 39]

green

green: number[] = [32, 39]

grey

grey: number[] = [90, 39]

hidden

hidden: number[] = [8, 28]

inverse

inverse: number[] = [7, 27]

italic

italic: number[] = [3, 23]

magenta

magenta: number[] = [35, 39]

red

red: number[] = [31, 39]

reset

reset: number[] = [0, 0]

strikethrough

strikethrough: number[] = [9, 29]

underline

underline: number[] = [4, 24]

white

white: number[] = [37, 39]

yellow

yellow: number[] = [33, 39]

Generated using TypeDoc