All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.src.index.ts Maven / Gradle / Ivy

The newest version!
export default function memoize(fn: (arg: string) => V): (arg: string) => V {
  const cache: Record = Object.create(null)

  return (arg: string) => {
    if (cache[arg] === undefined) cache[arg] = fn(arg)
    return cache[arg]
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy