Skip to content

Commit

Permalink
fix(utils): Clarify API docs that memoize() only returns one value
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Jan 29, 2024
1 parent 8052e62 commit 98a8119
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/pl/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,8 @@ end
-- This is useful if you have a function which is relatively expensive,
-- but you don't know in advance what values will be required, so
-- building a table upfront is wasteful/impossible.
-- @param func a function that takes exactly one argument
-- @return a function taking one argument, which is used as the cache key.
-- @param func a function that takes exactly one argument (which later serves as the cache key) and returns a single value
-- @return a function taking one argument and returning a single value either from the cache or by running the original input function
function utils.memoize(func)
local cache = {}
return function(k)
Expand Down

0 comments on commit 98a8119

Please sign in to comment.