npm install memoize-async
memoize-asyncexpects the global
Promiseto be defined
const fn =const memFetch =// must resolve from fn// resolves from cache
const fn =const keyGen = useridconst memFetchUserProfile =const user =id: '1234-5678'profile: ''// sets cache key to '1234-5678'// resolves from cache
const url = ''const fn =const memFetch =const CLEAR_TIMER = 1000 * 60 * 5// also
npm test. To also generate coverage run
npm run test:coverage.