Magic cache 🍒 caches your lodash 📦 at Node.js for you.
Meant to be used with lodash-magic-import ✨
> npm i --save lodash lodash-magic-cache
with
const _ = require('lodash-magic-cache').lodash([
'map', 'forEach', 'keys'
]);
or
const _cache = require('lodash-magic-cache').lodashFP([
'map', 'forEach', 'keys'
]);
It's quite simple.
Well, require
'ing whole lodash takes a lot of time.
Even require
'ing the same modules over and over is a hassle.
It's much faster on Node.js with a dedicated _.memoize
powered cache.
lodash-magic-cache
makes sense when you're targeting plain node.js, or using babel
with lodash-magic-import.
It's completely pointless with a bundler like webpack or rollup, because they've already using similar caching technique.
Feel free to ask some questions via Discord.
Licensed under MIT license, of course.