Our great sponsors
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
I recently did some testing on the most popular memoization libraries and found moize to be the most fully-featured, actively maintained, and performant.
The author has also published a bare-bones version called micro-memoize. If you care about bundle size and don't need any bells and whistles, this is likely your best bet. If you do end up going that route, watch out for the default maxSize of 1, meaning unless you specify otherwise, it will only store the most recent result in the cache.
If the code should, as you say, be 5 lines, why take on a dependency at all? By doing so, you end up with a catch-all solution that does almost nothing other than JSON.stringify your args, which is extremely poorly optimized to handle many situations, e.g. one of your args is a primitive and the other is a large config object.