Options
All
  • Public
  • Public/Protected
  • All
Menu

Module lang

Variables

Language Functions

Other Functions

Variables

Const langIteratorSymbol

langIteratorSymbol: typeof iterator | "@@iterator" = ...

Expose iteratorSymbol

Language Functions

match

  • match<Type>(value: any, subjectExpression: Record<string, Type> | Map<any, Type> | WeakMap<object, Type>, defaultValue?: Type, convertToString?: boolean): Type
  • name

    match

    description

    Match expression

    summary

    import { match } from "@corefunc/corefunc/lang/match";

    since

    0.3.3

    example

    match(String(5), { "1": "One", "3": "Three", "5": "Five" }); ➜ "Five"

    example

    match(5, new Map([ ["5", "Oh no!"], [5, "OK"], ])); ➜ "OK"

    example

    match(5, { 5: "Five" }, undefined, true); ➜ "Five"

    Type parameters

    • Type

    Parameters

    • value: any
    • subjectExpression: Record<string, Type> | Map<any, Type> | WeakMap<object, Type>
    • defaultValue: Type = ...
    • convertToString: boolean = false

    Returns Type

Other Functions

langSleep

  • langSleep(timeout?: number): Promise<void>
  • name

    langSleep

    description

    Sleep ES queue code execution for requested time

    Parameters

    • timeout: number = 1

    Returns Promise<void>

langSpaceship

  • langSpaceship(valueOne: any, valueTwo: any): number
  • name

    langSpaceship

    description

    Combined comparison for JavaScript <=> A <=> B := if A < B then return -1 if A = B then return 0 if A > B then return 1

    Parameters

    • valueOne: any
    • valueTwo: any

    Returns number

Generated using TypeDoc