@jossmac/lil-libs
    Preparing search index...

    Function resolveMaybeFn

    • Resolves a literal value or invokes a unary callback.

      • V
      • A
      • value: V | ((arg: A) => V)

        Literal value to return as-is, or a unary function to invoke.

      • Optionalarg: A

        Argument passed when value is a function; ignored otherwise.

      value directly, or the result of value(arg) when value is a function.

      resolveMaybeFn(42); // 42
      resolveMaybeFn((x: number) => x * 2, 21); // 42