Function matchSync

  • Poor man's pattern matching in JS Use it like a switch-case that is capable of doing deep equality Unlike switch-case, it cannot assert the data type in the procedure Without a default case, the returned value is undefined Synchronous version

    Type Parameters

    • T

    Parameters

    • data: any

    Returns ((...cases) => T)

      • (...cases): T
      • Parameters

        • Rest ...cases: readonly [...CaseSync<T>[], ProcSync<T>] | readonly [...CaseSync<T>[]]

        Returns T

Generated using TypeDoc