diff --git a/docs/classes/DependencyNotRegisteredError.html b/docs/classes/DependencyNotRegisteredError.html index 90e57f0..8d35e5f 100644 --- a/docs/classes/DependencyNotRegisteredError.html +++ b/docs/classes/DependencyNotRegisteredError.html @@ -1,4 +1,4 @@ -DependencyNotRegisteredError | ts-fp-di

Class DependencyNotRegisteredError

Hierarchy

  • Error
    • DependencyNotRegisteredError

Constructors

constructor +DependencyNotRegisteredError | ts-fp-di

Class DependencyNotRegisteredError

Hierarchy

  • Error
    • DependencyNotRegisteredError

Constructors

Properties

Methods

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string
prepareStackTrace?: ((err: Error, stackTraces: CallSite[]) => any)

Optional override for formatting stack traces

+

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string
prepareStackTrace?: ((err: Error, stackTraces: CallSite[]) => any)

Optional override for formatting stack traces

stackTraceLimit: number

Methods

  • Create .stack property on a target object

    Parameters

    • targetObject: object
    • OptionalconstructorOpt: Function

    Returns void

diff --git a/docs/classes/DiNotInitializedError.html b/docs/classes/DiNotInitializedError.html index b769fe9..168bd86 100644 --- a/docs/classes/DiNotInitializedError.html +++ b/docs/classes/DiNotInitializedError.html @@ -1,4 +1,4 @@ -DiNotInitializedError | ts-fp-di

Class DiNotInitializedError

Hierarchy

  • Error
    • DiNotInitializedError

Constructors

constructor +DiNotInitializedError | ts-fp-di

Class DiNotInitializedError

Hierarchy

  • Error
    • DiNotInitializedError

Constructors

Properties

Methods

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string
prepareStackTrace?: ((err: Error, stackTraces: CallSite[]) => any)

Optional override for formatting stack traces

+

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string
prepareStackTrace?: ((err: Error, stackTraces: CallSite[]) => any)

Optional override for formatting stack traces

stackTraceLimit: number

Methods

  • Create .stack property on a target object

    Parameters

    • targetObject: object
    • OptionalconstructorOpt: Function

    Returns void

diff --git a/docs/functions/clearGlobalState.html b/docs/functions/clearGlobalState.html index a60ff56..1bfe0e9 100644 --- a/docs/functions/clearGlobalState.html +++ b/docs/functions/clearGlobalState.html @@ -1 +1 @@ -clearGlobalState | ts-fp-di

Function clearGlobalState

  • Returns void

+clearGlobalState | ts-fp-di

Function clearGlobalState

  • Returns void

diff --git a/docs/functions/di.html b/docs/functions/di.html index d924f46..a5d6338 100644 --- a/docs/functions/di.html +++ b/docs/functions/di.html @@ -3,4 +3,4 @@
const fun = di(x => x + 1)
fun(1) // 2
diSet(fun, x => x + 2)
fun(1) // 3
-
+
diff --git a/docs/functions/diContext.html b/docs/functions/diContext.html index e6e40a8..02653a2 100644 --- a/docs/functions/diContext.html +++ b/docs/functions/diContext.html @@ -1 +1 @@ -diContext | ts-fp-di

Function diContext

  • Returns AlsContext

+diContext | ts-fp-di

Function diContext

  • Returns AlsContext

diff --git a/docs/functions/diDep.html b/docs/functions/diDep.html index 3210113..79b4f82 100644 --- a/docs/functions/diDep.html +++ b/docs/functions/diDep.html @@ -5,10 +5,10 @@

DiNotInitializedError if called outside of diInit callback

DependencyNotRegisteredError if dependency not registered

-
  • Extract overriden function from Dependency Injection

    +
  • Extract overriden function from Dependency Injection

    Should be called within diInit callback

    Type Parameters

    Parameters

    Returns T

    const fun = () => 1
    diSet(fun, () => 2)
    diDep(fun)() // 2

    DiNotInitializedError if called outside of diInit callback

    -
  • +
    diff --git a/docs/functions/diExists.html b/docs/functions/diExists.html index ac46ffe..db462d8 100644 --- a/docs/functions/diExists.html +++ b/docs/functions/diExists.html @@ -2,4 +2,4 @@
    diExists() // false
    diInit(() => diExists()) // true
    -
    +
    diff --git a/docs/functions/diHas.html b/docs/functions/diHas.html index 6b94f44..a8b2dc9 100644 --- a/docs/functions/diHas.html +++ b/docs/functions/diHas.html @@ -4,10 +4,10 @@

    DiNotInitializedError if called outside of diInit callback

    -
  • Check that dependency was registered by string literal in Dependency Injection container

    +
  • Check that dependency was registered by string literal in Dependency Injection container

    Should be called within diInit callback

    Parameters

    Returns boolean

    const user: User = {login: 'root', roles: ['admin']}
    diSet('user', user)
    diHas('user') // true

    DiNotInitializedError if called outside of diInit callback

    -
  • +
    diff --git a/docs/functions/diInit.html b/docs/functions/diInit.html index 68dff66..2e448c4 100644 --- a/docs/functions/diInit.html +++ b/docs/functions/diInit.html @@ -1 +1,6 @@ -diInit | ts-fp-di

    Function diInit

    • Type Parameters

      • T

      Parameters

      • cb: (() => T)
          • (): T
          • Returns T

      • Optionalctx: AlsContext

      Returns T

    +diInit | ts-fp-di

    Function diInit

    Entry point for almost all ts-fp-di API

    +

    Should be called on each HTTP request, MQ message handling, cron job or just in test

    +
    diInit(() => {
    // ts-fp-di API usage here
    // or call `next` function of middleware here
    }) +
    + +
    • Type Parameters

      • T

      Parameters

      • cb: (() => T)
          • (): T
          • Returns T

      • Optionalctx: AlsContext

      Returns T

    diff --git a/docs/functions/diMap.html b/docs/functions/diMap.html index cc7a543..0c55c5e 100644 --- a/docs/functions/diMap.html +++ b/docs/functions/diMap.html @@ -1 +1 @@ -diMap | ts-fp-di

    Function diMap

    • Type Parameters

      • T1
      • R

      Parameters

      • pred: ((x1: T1) => R)
          • (x1): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      Returns (() => R) & {
          raw: ((x1: T1) => R);
      }

    • Type Parameters

      • T1
      • T2
      • R

      Parameters

      • pred: ((x1: T1, x2: T2) => R)
          • (x1, x2): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3) => R)
          • (x1, x2, x3): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4) => R)
          • (x1, x2, x3, x4): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5) => R)
          • (x1, x2, x3, x4, x5): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      • fn5: ((...args: any[]) => T5)
          • (...args): T5
          • Parameters

            • Rest...args: any[]

            Returns T5

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6) => R)
          • (x1, x2, x3, x4, x5, x6): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      • fn5: ((...args: any[]) => T5)
          • (...args): T5
          • Parameters

            • Rest...args: any[]

            Returns T5

      • fn6: ((...args: any[]) => T6)
          • (...args): T6
          • Parameters

            • Rest...args: any[]

            Returns T6

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7) => R)
          • (x1, x2, x3, x4, x5, x6, x7): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      • fn5: ((...args: any[]) => T5)
          • (...args): T5
          • Parameters

            • Rest...args: any[]

            Returns T5

      • fn6: ((...args: any[]) => T6)
          • (...args): T6
          • Parameters

            • Rest...args: any[]

            Returns T6

      • fn7: ((...args: any[]) => T7)
          • (...args): T7
          • Parameters

            • Rest...args: any[]

            Returns T7

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7
      • T8
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8) => R)
          • (x1, x2, x3, x4, x5, x6, x7, x8): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      • fn5: ((...args: any[]) => T5)
          • (...args): T5
          • Parameters

            • Rest...args: any[]

            Returns T5

      • fn6: ((...args: any[]) => T6)
          • (...args): T6
          • Parameters

            • Rest...args: any[]

            Returns T6

      • fn7: ((...args: any[]) => T7)
          • (...args): T7
          • Parameters

            • Rest...args: any[]

            Returns T7

      • fn8: ((...args: any[]) => T8)
          • (...args): T8
          • Parameters

            • Rest...args: any[]

            Returns T8

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7
      • T8
      • T9
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9) => R)
          • (x1, x2, x3, x4, x5, x6, x7, x8, x9): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      • fn5: ((...args: any[]) => T5)
          • (...args): T5
          • Parameters

            • Rest...args: any[]

            Returns T5

      • fn6: ((...args: any[]) => T6)
          • (...args): T6
          • Parameters

            • Rest...args: any[]

            Returns T6

      • fn7: ((...args: any[]) => T7)
          • (...args): T7
          • Parameters

            • Rest...args: any[]

            Returns T7

      • fn8: ((...args: any[]) => T8)
          • (...args): T8
          • Parameters

            • Rest...args: any[]

            Returns T8

      • fn9: ((...args: any[]) => T9)
          • (...args): T9
          • Parameters

            • Rest...args: any[]

            Returns T9

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7
      • T8
      • T9
      • T10
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10) => R)
          • (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      • fn5: ((...args: any[]) => T5)
          • (...args): T5
          • Parameters

            • Rest...args: any[]

            Returns T5

      • fn6: ((...args: any[]) => T6)
          • (...args): T6
          • Parameters

            • Rest...args: any[]

            Returns T6

      • fn7: ((...args: any[]) => T7)
          • (...args): T7
          • Parameters

            • Rest...args: any[]

            Returns T7

      • fn8: ((...args: any[]) => T8)
          • (...args): T8
          • Parameters

            • Rest...args: any[]

            Returns T8

      • fn9: ((...args: any[]) => T9)
          • (...args): T9
          • Parameters

            • Rest...args: any[]

            Returns T9

      • fn10: ((...args: any[]) => T10)
          • (...args): T10
          • Parameters

            • Rest...args: any[]

            Returns T10

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10) => R);
      }

    +diMap | ts-fp-di

    Function diMap

    • Type Parameters

      • T1
      • R

      Parameters

      • pred: ((x1: T1) => R)
          • (x1): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      Returns (() => R) & {
          raw: ((x1: T1) => R);
      }

    • Type Parameters

      • T1
      • T2
      • R

      Parameters

      • pred: ((x1: T1, x2: T2) => R)
          • (x1, x2): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3) => R)
          • (x1, x2, x3): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4) => R)
          • (x1, x2, x3, x4): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5) => R)
          • (x1, x2, x3, x4, x5): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      • fn5: ((...args: any[]) => T5)
          • (...args): T5
          • Parameters

            • Rest...args: any[]

            Returns T5

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6) => R)
          • (x1, x2, x3, x4, x5, x6): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      • fn5: ((...args: any[]) => T5)
          • (...args): T5
          • Parameters

            • Rest...args: any[]

            Returns T5

      • fn6: ((...args: any[]) => T6)
          • (...args): T6
          • Parameters

            • Rest...args: any[]

            Returns T6

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7) => R)
          • (x1, x2, x3, x4, x5, x6, x7): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      • fn5: ((...args: any[]) => T5)
          • (...args): T5
          • Parameters

            • Rest...args: any[]

            Returns T5

      • fn6: ((...args: any[]) => T6)
          • (...args): T6
          • Parameters

            • Rest...args: any[]

            Returns T6

      • fn7: ((...args: any[]) => T7)
          • (...args): T7
          • Parameters

            • Rest...args: any[]

            Returns T7

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7
      • T8
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8) => R)
          • (x1, x2, x3, x4, x5, x6, x7, x8): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      • fn5: ((...args: any[]) => T5)
          • (...args): T5
          • Parameters

            • Rest...args: any[]

            Returns T5

      • fn6: ((...args: any[]) => T6)
          • (...args): T6
          • Parameters

            • Rest...args: any[]

            Returns T6

      • fn7: ((...args: any[]) => T7)
          • (...args): T7
          • Parameters

            • Rest...args: any[]

            Returns T7

      • fn8: ((...args: any[]) => T8)
          • (...args): T8
          • Parameters

            • Rest...args: any[]

            Returns T8

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7
      • T8
      • T9
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9) => R)
          • (x1, x2, x3, x4, x5, x6, x7, x8, x9): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      • fn5: ((...args: any[]) => T5)
          • (...args): T5
          • Parameters

            • Rest...args: any[]

            Returns T5

      • fn6: ((...args: any[]) => T6)
          • (...args): T6
          • Parameters

            • Rest...args: any[]

            Returns T6

      • fn7: ((...args: any[]) => T7)
          • (...args): T7
          • Parameters

            • Rest...args: any[]

            Returns T7

      • fn8: ((...args: any[]) => T8)
          • (...args): T8
          • Parameters

            • Rest...args: any[]

            Returns T8

      • fn9: ((...args: any[]) => T9)
          • (...args): T9
          • Parameters

            • Rest...args: any[]

            Returns T9

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7
      • T8
      • T9
      • T10
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10) => R)
          • (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      • fn5: ((...args: any[]) => T5)
          • (...args): T5
          • Parameters

            • Rest...args: any[]

            Returns T5

      • fn6: ((...args: any[]) => T6)
          • (...args): T6
          • Parameters

            • Rest...args: any[]

            Returns T6

      • fn7: ((...args: any[]) => T7)
          • (...args): T7
          • Parameters

            • Rest...args: any[]

            Returns T7

      • fn8: ((...args: any[]) => T8)
          • (...args): T8
          • Parameters

            • Rest...args: any[]

            Returns T8

      • fn9: ((...args: any[]) => T9)
          • (...args): T9
          • Parameters

            • Rest...args: any[]

            Returns T9

      • fn10: ((...args: any[]) => T10)
          • (...args): T10
          • Parameters

            • Rest...args: any[]

            Returns T10

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10) => R);
      }

    diff --git a/docs/functions/diMapOnce.html b/docs/functions/diMapOnce.html index b524053..67af092 100644 --- a/docs/functions/diMapOnce.html +++ b/docs/functions/diMapOnce.html @@ -1 +1 @@ -diMapOnce | ts-fp-di

    Function diMapOnce

    • Type Parameters

      • T1
      • R

      Parameters

      • pred: ((x1: T1) => R)
          • (x1): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      Returns (() => R) & {
          raw: ((x1: T1) => R);
      }

    • Type Parameters

      • T1
      • T2
      • R

      Parameters

      • pred: ((x1: T1, x2: T2) => R)
          • (x1, x2): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3) => R)
          • (x1, x2, x3): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4) => R)
          • (x1, x2, x3, x4): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5) => R)
          • (x1, x2, x3, x4, x5): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      • fn5: ((...args: any[]) => T5)
          • (...args): T5
          • Parameters

            • Rest...args: any[]

            Returns T5

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6) => R)
          • (x1, x2, x3, x4, x5, x6): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      • fn5: ((...args: any[]) => T5)
          • (...args): T5
          • Parameters

            • Rest...args: any[]

            Returns T5

      • fn6: ((...args: any[]) => T6)
          • (...args): T6
          • Parameters

            • Rest...args: any[]

            Returns T6

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7) => R)
          • (x1, x2, x3, x4, x5, x6, x7): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      • fn5: ((...args: any[]) => T5)
          • (...args): T5
          • Parameters

            • Rest...args: any[]

            Returns T5

      • fn6: ((...args: any[]) => T6)
          • (...args): T6
          • Parameters

            • Rest...args: any[]

            Returns T6

      • fn7: ((...args: any[]) => T7)
          • (...args): T7
          • Parameters

            • Rest...args: any[]

            Returns T7

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7
      • T8
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8) => R)
          • (x1, x2, x3, x4, x5, x6, x7, x8): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      • fn5: ((...args: any[]) => T5)
          • (...args): T5
          • Parameters

            • Rest...args: any[]

            Returns T5

      • fn6: ((...args: any[]) => T6)
          • (...args): T6
          • Parameters

            • Rest...args: any[]

            Returns T6

      • fn7: ((...args: any[]) => T7)
          • (...args): T7
          • Parameters

            • Rest...args: any[]

            Returns T7

      • fn8: ((...args: any[]) => T8)
          • (...args): T8
          • Parameters

            • Rest...args: any[]

            Returns T8

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7
      • T8
      • T9
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9) => R)
          • (x1, x2, x3, x4, x5, x6, x7, x8, x9): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      • fn5: ((...args: any[]) => T5)
          • (...args): T5
          • Parameters

            • Rest...args: any[]

            Returns T5

      • fn6: ((...args: any[]) => T6)
          • (...args): T6
          • Parameters

            • Rest...args: any[]

            Returns T6

      • fn7: ((...args: any[]) => T7)
          • (...args): T7
          • Parameters

            • Rest...args: any[]

            Returns T7

      • fn8: ((...args: any[]) => T8)
          • (...args): T8
          • Parameters

            • Rest...args: any[]

            Returns T8

      • fn9: ((...args: any[]) => T9)
          • (...args): T9
          • Parameters

            • Rest...args: any[]

            Returns T9

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7
      • T8
      • T9
      • T10
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10) => R)
          • (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      • fn5: ((...args: any[]) => T5)
          • (...args): T5
          • Parameters

            • Rest...args: any[]

            Returns T5

      • fn6: ((...args: any[]) => T6)
          • (...args): T6
          • Parameters

            • Rest...args: any[]

            Returns T6

      • fn7: ((...args: any[]) => T7)
          • (...args): T7
          • Parameters

            • Rest...args: any[]

            Returns T7

      • fn8: ((...args: any[]) => T8)
          • (...args): T8
          • Parameters

            • Rest...args: any[]

            Returns T8

      • fn9: ((...args: any[]) => T9)
          • (...args): T9
          • Parameters

            • Rest...args: any[]

            Returns T9

      • fn10: ((...args: any[]) => T10)
          • (...args): T10
          • Parameters

            • Rest...args: any[]

            Returns T10

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10) => R);
      }

    +diMapOnce | ts-fp-di

    Function diMapOnce

    • Type Parameters

      • T1
      • R

      Parameters

      • pred: ((x1: T1) => R)
          • (x1): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      Returns (() => R) & {
          raw: ((x1: T1) => R);
      }

    • Type Parameters

      • T1
      • T2
      • R

      Parameters

      • pred: ((x1: T1, x2: T2) => R)
          • (x1, x2): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3) => R)
          • (x1, x2, x3): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4) => R)
          • (x1, x2, x3, x4): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5) => R)
          • (x1, x2, x3, x4, x5): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      • fn5: ((...args: any[]) => T5)
          • (...args): T5
          • Parameters

            • Rest...args: any[]

            Returns T5

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6) => R)
          • (x1, x2, x3, x4, x5, x6): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      • fn5: ((...args: any[]) => T5)
          • (...args): T5
          • Parameters

            • Rest...args: any[]

            Returns T5

      • fn6: ((...args: any[]) => T6)
          • (...args): T6
          • Parameters

            • Rest...args: any[]

            Returns T6

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7) => R)
          • (x1, x2, x3, x4, x5, x6, x7): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      • fn5: ((...args: any[]) => T5)
          • (...args): T5
          • Parameters

            • Rest...args: any[]

            Returns T5

      • fn6: ((...args: any[]) => T6)
          • (...args): T6
          • Parameters

            • Rest...args: any[]

            Returns T6

      • fn7: ((...args: any[]) => T7)
          • (...args): T7
          • Parameters

            • Rest...args: any[]

            Returns T7

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7
      • T8
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8) => R)
          • (x1, x2, x3, x4, x5, x6, x7, x8): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      • fn5: ((...args: any[]) => T5)
          • (...args): T5
          • Parameters

            • Rest...args: any[]

            Returns T5

      • fn6: ((...args: any[]) => T6)
          • (...args): T6
          • Parameters

            • Rest...args: any[]

            Returns T6

      • fn7: ((...args: any[]) => T7)
          • (...args): T7
          • Parameters

            • Rest...args: any[]

            Returns T7

      • fn8: ((...args: any[]) => T8)
          • (...args): T8
          • Parameters

            • Rest...args: any[]

            Returns T8

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7
      • T8
      • T9
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9) => R)
          • (x1, x2, x3, x4, x5, x6, x7, x8, x9): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      • fn5: ((...args: any[]) => T5)
          • (...args): T5
          • Parameters

            • Rest...args: any[]

            Returns T5

      • fn6: ((...args: any[]) => T6)
          • (...args): T6
          • Parameters

            • Rest...args: any[]

            Returns T6

      • fn7: ((...args: any[]) => T7)
          • (...args): T7
          • Parameters

            • Rest...args: any[]

            Returns T7

      • fn8: ((...args: any[]) => T8)
          • (...args): T8
          • Parameters

            • Rest...args: any[]

            Returns T8

      • fn9: ((...args: any[]) => T9)
          • (...args): T9
          • Parameters

            • Rest...args: any[]

            Returns T9

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9) => R);
      }

    • Type Parameters

      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7
      • T8
      • T9
      • T10
      • R

      Parameters

      • pred: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10) => R)
          • (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10): R
          • Parameters

            Returns R

      • fn1: ((...args: any[]) => T1)
          • (...args): T1
          • Parameters

            • Rest...args: any[]

            Returns T1

      • fn2: ((...args: any[]) => T2)
          • (...args): T2
          • Parameters

            • Rest...args: any[]

            Returns T2

      • fn3: ((...args: any[]) => T3)
          • (...args): T3
          • Parameters

            • Rest...args: any[]

            Returns T3

      • fn4: ((...args: any[]) => T4)
          • (...args): T4
          • Parameters

            • Rest...args: any[]

            Returns T4

      • fn5: ((...args: any[]) => T5)
          • (...args): T5
          • Parameters

            • Rest...args: any[]

            Returns T5

      • fn6: ((...args: any[]) => T6)
          • (...args): T6
          • Parameters

            • Rest...args: any[]

            Returns T6

      • fn7: ((...args: any[]) => T7)
          • (...args): T7
          • Parameters

            • Rest...args: any[]

            Returns T7

      • fn8: ((...args: any[]) => T8)
          • (...args): T8
          • Parameters

            • Rest...args: any[]

            Returns T8

      • fn9: ((...args: any[]) => T9)
          • (...args): T9
          • Parameters

            • Rest...args: any[]

            Returns T9

      • fn10: ((...args: any[]) => T10)
          • (...args): T10
          • Parameters

            • Rest...args: any[]

            Returns T10

      Returns (() => R) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10) => R);
      }

    diff --git a/docs/functions/diOnce.html b/docs/functions/diOnce.html index be737fd..3809947 100644 --- a/docs/functions/diOnce.html +++ b/docs/functions/diOnce.html @@ -1 +1,5 @@ -diOnce | ts-fp-di

    Function diOnce

    • Type Parameters

      • T extends ((...args: any) => any)

      Parameters

      • fn: T

      Returns T

    +diOnce | ts-fp-di

    Function diOnce

    Make function, which calling result will be cached within diInit callback

    +
    const fun = diOnce(n => n + 1)
    fun(1) // 2
    fun(8) // again 2, because it's cached +
    + +
    • Type Parameters

      • T extends Function

      Parameters

      • fn: T

      Returns T

    diff --git a/docs/functions/diOnceSet.html b/docs/functions/diOnceSet.html index 6082256..88c76f3 100644 --- a/docs/functions/diOnceSet.html +++ b/docs/functions/diOnceSet.html @@ -1 +1,6 @@ -diOnceSet | ts-fp-di

    Function diOnceSet

    • Type Parameters

      • T

      Parameters

      • fn: ((...args: any[]) => T)
          • (...args): T
          • Parameters

            • Rest...args: any[]

            Returns T

      • value: T

      Returns void

    +diOnceSet | ts-fp-di

    Function diOnceSet

    Override cached result of diOnce call

    +

    Should be cached within diInit callback

    +
    const fun = diOnce(n => n + 1)
    fun(1) // 2
    diOnceSet(fun, 9)
    fun(8) // 9 +
    + +
    • Type Parameters

      • T extends ((...args: any[]) => any)

      Parameters

      • fn: T
      • value: ReturnType<T>

      Returns void

    diff --git a/docs/functions/diScope.html b/docs/functions/diScope.html index b788e0b..c066e21 100644 --- a/docs/functions/diScope.html +++ b/docs/functions/diScope.html @@ -1 +1 @@ -diScope | ts-fp-di

    Function diScope

    • Type Parameters

      • T extends {
            [key: string]: any;
        }

      Parameters

      • scope: T
      • Optionalinit: (() => void)
          • (): void
          • Returns void

      Returns T

    +diScope | ts-fp-di

    Function diScope

    • Type Parameters

      • T extends {
            [key: string]: any;
        }

      Parameters

      • scope: T
      • Optionalinit: (() => void)
          • (): void
          • Returns void

      Returns T

    diff --git a/docs/functions/diSet.html b/docs/functions/diSet.html index bd2b153..9f46ca2 100644 --- a/docs/functions/diSet.html +++ b/docs/functions/diSet.html @@ -4,11 +4,11 @@

    DiNotInitializedError if called outside of diInit callback

    -
  • Register any value inside Dependency Injection container by unique string literal

    +
  • Register any value inside Dependency Injection container by unique string literal

    Can be extracted later using diDep

    Should be called within diInit callback

    Parameters

    Returns void

    type User = {
    login: string;
    roles: string[];
    }
    const user: User = {login: 'root', roles: ['admin']}
    diSet('user', user)
    diDep<User>('user') // {login: 'root', roles: ['admin']}

    DiNotInitializedError if called outside of diInit callback

    -
  • +
    diff --git a/docs/functions/dic.html b/docs/functions/dic.html index 0eda0f5..414fb73 100644 --- a/docs/functions/dic.html +++ b/docs/functions/dic.html @@ -1 +1 @@ -dic | ts-fp-di

    Function dic

    • Type Parameters

      • T

      Returns ((x?: T) => T)

        • (x?): T
        • Parameters

          • Optionalx: T

          Returns T

    +dic | ts-fp-di

    Function dic

    • Type Parameters

      • T

      Returns ((x?: T) => T)

        • (x?): T
        • Parameters

          • Optionalx: T

          Returns T

    diff --git a/docs/functions/dis.html b/docs/functions/dis.html index d54f172..7dab4b5 100644 --- a/docs/functions/dis.html +++ b/docs/functions/dis.html @@ -1 +1 @@ -dis | ts-fp-di

    Function dis

    • Type Parameters

      • P
      • S

      Parameters

      • fn: ((state: S, payload: P) => S)
          • (state, payload): S
          • Parameters

            • state: S
            • payload: P

            Returns S

      • defaultState: S
      • isGlobal: boolean = false

      Returns ((this: unknown, payload?: P) => S)

        • (this, payload?): S
        • Parameters

          • this: unknown
          • Optionalpayload: P

          Returns S

    +dis | ts-fp-di

    Function dis

    • Type Parameters

      • P
      • S

      Parameters

      • fn: ((state: S, payload: P) => S)
          • (state, payload): S
          • Parameters

            • state: S
            • payload: P

            Returns S

      • defaultState: S
      • isGlobal: boolean = false

      Returns ((this: unknown, payload?: P) => S)

        • (this, payload?): S
        • Parameters

          • this: unknown
          • Optionalpayload: P

          Returns S

    diff --git a/docs/functions/dise.html b/docs/functions/dise.html index 9d629af..72db6b3 100644 --- a/docs/functions/dise.html +++ b/docs/functions/dise.html @@ -1 +1 @@ -dise | ts-fp-di

    Function dise

    • Type Parameters

      • R

      Parameters

      • effect: (() => Promise<R>)
          • (): Promise<R>
          • Returns Promise<R>

      • dicOutput: ((x: R) => R)
          • (x): R
          • Parameters

            Returns R

      Returns (() => Promise<R>) & {
          raw: (() => Promise<R>);
      }

    • Type Parameters

      • R
      • T1

      Parameters

      • effect: ((x1: T1) => Promise<R>)
          • (x1): Promise<R>
          • Parameters

            Returns Promise<R>

      • dicOutput: ((x: R) => R)
          • (x): R
          • Parameters

            Returns R

      • dicInput1: (() => T1)

      Returns (() => Promise<R>) & {
          raw: ((x1: T1) => Promise<R>);
      }

    • Type Parameters

      • R
      • I
      • T1
      • T2

      Parameters

      • effect: ((x1: T1, x2: T2) => Promise<R>)
          • (x1, x2): Promise<R>
          • Parameters

            Returns Promise<R>

      • dicOutput: ((x: R) => R)
          • (x): R
          • Parameters

            Returns R

      • dicInput1: (() => T1)
      • dicInput2: (() => T2)

      Returns (() => Promise<R>) & {
          raw: ((x1: T1, x2: T2) => Promise<R>);
      }

    • Type Parameters

      • R
      • T1
      • T2
      • T3

      Parameters

      • effect: ((x1: T1, x2: T2, x3: T3) => Promise<R>)
          • (x1, x2, x3): Promise<R>
          • Parameters

            Returns Promise<R>

      • dicOutput: ((x: R) => R)
          • (x): R
          • Parameters

            Returns R

      • dicInput1: (() => T1)
      • dicInput2: (() => T2)
      • dicInput3: (() => T3)

      Returns (() => Promise<R>) & {
          raw: ((x1: T1, x2: T2, x3: T3) => Promise<R>);
      }

    • Type Parameters

      • R
      • T1
      • T2
      • T3
      • T4

      Parameters

      • effect: ((x1: T1, x2: T2, x3: T3, x4: T4) => Promise<R>)
          • (x1, x2, x3, x4): Promise<R>
          • Parameters

            Returns Promise<R>

      • dicOutput: ((x: R) => R)
          • (x): R
          • Parameters

            Returns R

      • dicInput1: (() => T1)
      • dicInput2: (() => T2)
      • dicInput3: (() => T3)
      • dicInput4: (() => T4)

      Returns (() => Promise<R>) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4) => Promise<R>);
      }

    • Type Parameters

      • R
      • T1
      • T2
      • T3
      • T4
      • T5

      Parameters

      • effect: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5) => Promise<R>)
          • (x1, x2, x3, x4, x5): Promise<R>
          • Parameters

            Returns Promise<R>

      • dicOutput: ((x: R) => R)
          • (x): R
          • Parameters

            Returns R

      • dicInput1: (() => T1)
      • dicInput2: (() => T2)
      • dicInput3: (() => T3)
      • dicInput4: (() => T4)
      • dicInput5: (() => T5)

      Returns (() => Promise<R>) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5) => Promise<R>);
      }

    • Type Parameters

      • R
      • T1
      • T2
      • T3
      • T4
      • T5
      • T6

      Parameters

      • effect: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6) => Promise<R>)
          • (x1, x2, x3, x4, x5, x6): Promise<R>
          • Parameters

            Returns Promise<R>

      • dicOutput: ((x: R) => R)
          • (x): R
          • Parameters

            Returns R

      • dicInput1: (() => T1)
      • dicInput2: (() => T2)
      • dicInput3: (() => T3)
      • dicInput4: (() => T4)
      • dicInput5: (() => T5)
      • dicInput6: (() => T6)

      Returns (() => Promise<R>) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6) => Promise<R>);
      }

    • Type Parameters

      • R
      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7

      Parameters

      • effect: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7) => Promise<R>)
          • (x1, x2, x3, x4, x5, x6, x7): Promise<R>
          • Parameters

            Returns Promise<R>

      • dicOutput: ((x: R) => R)
          • (x): R
          • Parameters

            Returns R

      • dicInput1: (() => T1)
      • dicInput2: (() => T2)
      • dicInput3: (() => T3)
      • dicInput4: (() => T4)
      • dicInput5: (() => T5)
      • dicInput6: (() => T6)
      • dicInput7: (() => T7)

      Returns (() => Promise<R>) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7) => Promise<R>);
      }

    • Type Parameters

      • R
      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7
      • T8

      Parameters

      • effect: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8) => Promise<R>)
          • (x1, x2, x3, x4, x5, x6, x7, x8): Promise<R>
          • Parameters

            Returns Promise<R>

      • dicOutput: ((x: R) => R)
          • (x): R
          • Parameters

            Returns R

      • dicInput1: (() => T1)
      • dicInput2: (() => T2)
      • dicInput3: (() => T3)
      • dicInput4: (() => T4)
      • dicInput5: (() => T5)
      • dicInput6: (() => T6)
      • dicInput7: (() => T7)
      • dicInput8: (() => T8)

      Returns (() => Promise<R>) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8) => Promise<R>);
      }

    • Type Parameters

      • R
      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7
      • T8
      • T9

      Parameters

      • effect: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9) => Promise<R>)
          • (x1, x2, x3, x4, x5, x6, x7, x8, x9): Promise<R>
          • Parameters

            Returns Promise<R>

      • dicOutput: ((x: R) => R)
          • (x): R
          • Parameters

            Returns R

      • dicInput1: (() => T1)
      • dicInput2: (() => T2)
      • dicInput3: (() => T3)
      • dicInput4: (() => T4)
      • dicInput5: (() => T5)
      • dicInput6: (() => T6)
      • dicInput7: (() => T7)
      • dicInput8: (() => T8)
      • dicInput9: (() => T9)

      Returns (() => Promise<R>) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9) => Promise<R>);
      }

    • Type Parameters

      • R
      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7
      • T8
      • T9
      • T10

      Parameters

      • effect: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10) => Promise<R>)
          • (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10): Promise<R>
          • Parameters

            Returns Promise<R>

      • dicOutput: ((x: R) => R)
          • (x): R
          • Parameters

            Returns R

      • dicInput1: (() => T1)
      • dicInput2: (() => T2)
      • dicInput3: (() => T3)
      • dicInput4: (() => T4)
      • dicInput5: (() => T5)
      • dicInput6: (() => T6)
      • dicInput7: (() => T7)
      • dicInput8: (() => T8)
      • dicInput9: (() => T9)
      • dicInput10: (() => T10)

      Returns (() => Promise<R>) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10) => Promise<R>);
      }

    +dise | ts-fp-di

    Function dise

    • Type Parameters

      • R

      Parameters

      • effect: (() => Promise<R>)
          • (): Promise<R>
          • Returns Promise<R>

      • dicOutput: ((x: R) => R)
          • (x): R
          • Parameters

            Returns R

      Returns (() => Promise<R>) & {
          raw: (() => Promise<R>);
      }

    • Type Parameters

      • R
      • T1

      Parameters

      • effect: ((x1: T1) => Promise<R>)
          • (x1): Promise<R>
          • Parameters

            Returns Promise<R>

      • dicOutput: ((x: R) => R)
          • (x): R
          • Parameters

            Returns R

      • dicInput1: (() => T1)

      Returns (() => Promise<R>) & {
          raw: ((x1: T1) => Promise<R>);
      }

    • Type Parameters

      • R
      • I
      • T1
      • T2

      Parameters

      • effect: ((x1: T1, x2: T2) => Promise<R>)
          • (x1, x2): Promise<R>
          • Parameters

            Returns Promise<R>

      • dicOutput: ((x: R) => R)
          • (x): R
          • Parameters

            Returns R

      • dicInput1: (() => T1)
      • dicInput2: (() => T2)

      Returns (() => Promise<R>) & {
          raw: ((x1: T1, x2: T2) => Promise<R>);
      }

    • Type Parameters

      • R
      • T1
      • T2
      • T3

      Parameters

      • effect: ((x1: T1, x2: T2, x3: T3) => Promise<R>)
          • (x1, x2, x3): Promise<R>
          • Parameters

            Returns Promise<R>

      • dicOutput: ((x: R) => R)
          • (x): R
          • Parameters

            Returns R

      • dicInput1: (() => T1)
      • dicInput2: (() => T2)
      • dicInput3: (() => T3)

      Returns (() => Promise<R>) & {
          raw: ((x1: T1, x2: T2, x3: T3) => Promise<R>);
      }

    • Type Parameters

      • R
      • T1
      • T2
      • T3
      • T4

      Parameters

      • effect: ((x1: T1, x2: T2, x3: T3, x4: T4) => Promise<R>)
          • (x1, x2, x3, x4): Promise<R>
          • Parameters

            Returns Promise<R>

      • dicOutput: ((x: R) => R)
          • (x): R
          • Parameters

            Returns R

      • dicInput1: (() => T1)
      • dicInput2: (() => T2)
      • dicInput3: (() => T3)
      • dicInput4: (() => T4)

      Returns (() => Promise<R>) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4) => Promise<R>);
      }

    • Type Parameters

      • R
      • T1
      • T2
      • T3
      • T4
      • T5

      Parameters

      • effect: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5) => Promise<R>)
          • (x1, x2, x3, x4, x5): Promise<R>
          • Parameters

            Returns Promise<R>

      • dicOutput: ((x: R) => R)
          • (x): R
          • Parameters

            Returns R

      • dicInput1: (() => T1)
      • dicInput2: (() => T2)
      • dicInput3: (() => T3)
      • dicInput4: (() => T4)
      • dicInput5: (() => T5)

      Returns (() => Promise<R>) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5) => Promise<R>);
      }

    • Type Parameters

      • R
      • T1
      • T2
      • T3
      • T4
      • T5
      • T6

      Parameters

      • effect: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6) => Promise<R>)
          • (x1, x2, x3, x4, x5, x6): Promise<R>
          • Parameters

            Returns Promise<R>

      • dicOutput: ((x: R) => R)
          • (x): R
          • Parameters

            Returns R

      • dicInput1: (() => T1)
      • dicInput2: (() => T2)
      • dicInput3: (() => T3)
      • dicInput4: (() => T4)
      • dicInput5: (() => T5)
      • dicInput6: (() => T6)

      Returns (() => Promise<R>) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6) => Promise<R>);
      }

    • Type Parameters

      • R
      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7

      Parameters

      • effect: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7) => Promise<R>)
          • (x1, x2, x3, x4, x5, x6, x7): Promise<R>
          • Parameters

            Returns Promise<R>

      • dicOutput: ((x: R) => R)
          • (x): R
          • Parameters

            Returns R

      • dicInput1: (() => T1)
      • dicInput2: (() => T2)
      • dicInput3: (() => T3)
      • dicInput4: (() => T4)
      • dicInput5: (() => T5)
      • dicInput6: (() => T6)
      • dicInput7: (() => T7)

      Returns (() => Promise<R>) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7) => Promise<R>);
      }

    • Type Parameters

      • R
      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7
      • T8

      Parameters

      • effect: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8) => Promise<R>)
          • (x1, x2, x3, x4, x5, x6, x7, x8): Promise<R>
          • Parameters

            Returns Promise<R>

      • dicOutput: ((x: R) => R)
          • (x): R
          • Parameters

            Returns R

      • dicInput1: (() => T1)
      • dicInput2: (() => T2)
      • dicInput3: (() => T3)
      • dicInput4: (() => T4)
      • dicInput5: (() => T5)
      • dicInput6: (() => T6)
      • dicInput7: (() => T7)
      • dicInput8: (() => T8)

      Returns (() => Promise<R>) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8) => Promise<R>);
      }

    • Type Parameters

      • R
      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7
      • T8
      • T9

      Parameters

      • effect: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9) => Promise<R>)
          • (x1, x2, x3, x4, x5, x6, x7, x8, x9): Promise<R>
          • Parameters

            Returns Promise<R>

      • dicOutput: ((x: R) => R)
          • (x): R
          • Parameters

            Returns R

      • dicInput1: (() => T1)
      • dicInput2: (() => T2)
      • dicInput3: (() => T3)
      • dicInput4: (() => T4)
      • dicInput5: (() => T5)
      • dicInput6: (() => T6)
      • dicInput7: (() => T7)
      • dicInput8: (() => T8)
      • dicInput9: (() => T9)

      Returns (() => Promise<R>) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9) => Promise<R>);
      }

    • Type Parameters

      • R
      • T1
      • T2
      • T3
      • T4
      • T5
      • T6
      • T7
      • T8
      • T9
      • T10

      Parameters

      • effect: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10) => Promise<R>)
          • (x1, x2, x3, x4, x5, x6, x7, x8, x9, x10): Promise<R>
          • Parameters

            Returns Promise<R>

      • dicOutput: ((x: R) => R)
          • (x): R
          • Parameters

            Returns R

      • dicInput1: (() => T1)
      • dicInput2: (() => T2)
      • dicInput3: (() => T3)
      • dicInput4: (() => T4)
      • dicInput5: (() => T5)
      • dicInput6: (() => T6)
      • dicInput7: (() => T7)
      • dicInput8: (() => T8)
      • dicInput9: (() => T9)
      • dicInput10: (() => T10)

      Returns (() => Promise<R>) & {
          raw: ((x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, x10: T10) => Promise<R>);
      }

    diff --git a/docs/functions/diseSet.html b/docs/functions/diseSet.html index 0ab7ce9..380d03b 100644 --- a/docs/functions/diseSet.html +++ b/docs/functions/diseSet.html @@ -1 +1 @@ -diseSet | ts-fp-di

    Function diseSet

    • Type Parameters

      • T extends Function

      Parameters

      • fun: {
            raw: T;
        }
        • raw: T
      • replacement: T

      Returns void

    +diseSet | ts-fp-di

    Function diseSet

    • Type Parameters

      • T extends Function

      Parameters

      • fun: {
            raw: T;
        }
        • raw: T
      • replacement: T

      Returns void

    diff --git a/docs/functions/div.html b/docs/functions/div.html index a8208bc..ccaed38 100644 --- a/docs/functions/div.html +++ b/docs/functions/div.html @@ -1 +1 @@ -div | ts-fp-di

    Function div

    • Type Parameters

      • T

      Returns ((x?: T) => T)

        • (x?): T
        • Parameters

          • Optionalx: T

          Returns T

    +div | ts-fp-di

    Function div

    • Type Parameters

      • T

      Returns ((x?: T) => T)

        • (x?): T
        • Parameters

          • Optionalx: T

          Returns T

    diff --git a/docs/variables/als.html b/docs/variables/als.html index 15933d1..5a5fe6b 100644 --- a/docs/variables/als.html +++ b/docs/variables/als.html @@ -1 +1 @@ -als | ts-fp-di

    Variable alsConst

    als: AsyncLocalStorage<AlsContext> = ...
    +als | ts-fp-di

    Variable alsConst

    als: AsyncLocalStorage<AlsContext> = ...
    diff --git a/index.ts b/index.ts index c105c5a..52b6860 100644 --- a/index.ts +++ b/index.ts @@ -183,6 +183,18 @@ export function diHas(dep: unknown): boolean { return store.deps.has(dep) } +/** + * Entry point for almost all **ts-fp-di** API + * + * Should be called on each HTTP request, MQ message handling, cron job or just in test + * + * @example + * diInit(() => { + * // ts-fp-di API usage here + * // or call `next` function of middleware here + * }) + * + */ export const diInit = (cb: () => T, ctx?: AlsContext) => { return diExists() ? ctx @@ -200,8 +212,17 @@ export const diInit = (cb: () => T, ctx?: AlsContext) => { : als.run(ctx ?? diContext(), cb) } -export const diOnce = any>(fn: T) => { - const onceFn = function (this: unknown, ...args: Parameters) { +/** + * Make function, which calling result will be cached within {@link diInit} callback + * + * @example + * const fun = diOnce(n => n + 1) + * fun(1) // 2 + * fun(8) // again 2, because it's cached + * + */ +export const diOnce = (fn: T) => { + const onceFn = function (this: unknown, ...args: unknown[]) { const store = storeOrError() return store.once.get(onceFn) ?? store.once.set(onceFn, fn.apply(this, args)).get(onceFn) } as unknown as T @@ -209,7 +230,20 @@ export const diOnce = any>(fn: T) => { return onceFn } -export const diOnceSet = (fn: (...args: any[]) => T, value: T) => { +/** + * + * Override cached result of {@link diOnce} call + * + * Should be cached within {@link diInit} callback + * + * @example + * const fun = diOnce(n => n + 1) + * fun(1) // 2 + * diOnceSet(fun, 9) + * fun(8) // 9 + * + */ +export const diOnceSet = any>(fn: T, value: ReturnType) => { const store = storeOrError() store.once.set(fn, value) }