diff options
| author | William Boman <william@redwill.se> | 2021-10-18 15:11:57 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-18 15:11:57 +0200 |
| commit | eca6e5245e3afa55f12d13cb4c2306993eaf269e (patch) | |
| tree | f657f574812d556f6468427c70990d29f43d6641 /lua/nvim-lsp-installer/data.lua | |
| parent | feat: autogen metadata table(s) (#159) (diff) | |
| download | mason-eca6e5245e3afa55f12d13cb4c2306993eaf269e.tar mason-eca6e5245e3afa55f12d13cb4c2306993eaf269e.tar.gz mason-eca6e5245e3afa55f12d13cb4c2306993eaf269e.tar.bz2 mason-eca6e5245e3afa55f12d13cb4c2306993eaf269e.tar.lz mason-eca6e5245e3afa55f12d13cb4c2306993eaf269e.tar.xz mason-eca6e5245e3afa55f12d13cb4c2306993eaf269e.tar.zst mason-eca6e5245e3afa55f12d13cb4c2306993eaf269e.zip | |
ui: some more colors and a very crucial cowth vader lightsaber animation (#176)
Diffstat (limited to 'lua/nvim-lsp-installer/data.lua')
| -rw-r--r-- | lua/nvim-lsp-installer/data.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lua/nvim-lsp-installer/data.lua b/lua/nvim-lsp-installer/data.lua index b5689142..d9764bee 100644 --- a/lua/nvim-lsp-installer/data.lua +++ b/lua/nvim-lsp-installer/data.lua @@ -106,4 +106,18 @@ function Data.json_decode(data) end end +function Data.memoize(fn, cache_key_generator) + cache_key_generator = cache_key_generator or function(a) + return a + end + local cache = {} + return function(...) + local key = cache_key_generator(...) + if not cache[key] then + cache[key] = fn(...) + end + return cache[key] + end +end + return Data |
