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