Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

15 lines
402 B

import { create } from './object';
var memoize = function memoize(fn) {
var cache = create(null);
return function () {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var argsKey = JSON.stringify(args);
return cache[argsKey] = cache[argsKey] || fn.apply(null, args);
};
};
export default memoize;