Skip to content

Instantly share code, notes, and snippets.

@wdiasvargas
Created June 21, 2017 05:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wdiasvargas/263def6259f5696b14210212c7a5fea4 to your computer and use it in GitHub Desktop.
Save wdiasvargas/263def6259f5696b14210212c7a5fea4 to your computer and use it in GitHub Desktop.
/**
* Created in 20/06/2017.
* Author: William Dias Vargas
* Github: @wdiasvargas
*/
"use strict";
export default (fn, cache = {}) => (x) => (x in cache) ? cache[x] : cache[x] = fn(x);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment