var longRunningFunction = (ip) => { //do long running tasks and
return }
var longRunningFnBookKeeper = { 2 : 3, 4 : 5 }
//check if the key present in longRunningFnBookKeeper
//if get back the result else update the bookkeeping object
longRunningFnBookKeeper.hasOwnProperty(ip) ?
longRunningFnBookKeeper[ip] :
longRunningFnBookKeeper[ip] = longRunningFunction(ip)
A Pure Function Is a Mathematical Function
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.