@stdlib/esm
Version:
ES module distribution for Stdlib, a standard library for JavaScript and Node.js.
3 lines • 833 B
JavaScript
// This file is a part of stdlib. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
import r from"./../assert/is-function.js";import n from"./define-nonenumerable-read-only-property.js";import t from"./identity-function.js";import e from"./../assert/has-own-property.js";var o=r,a=n,i=t,u=e;function f(r,n){var t,e;if(!o(r))throw new TypeError("invalid argument. First argument must be a function. Value: `"+r+"`.");if(arguments.length<2)t=i;else if(!o(t=n))throw new TypeError("invalid argument. Hash function argument must be a function. Value: `"+t+"`.");return a(f,"cache",e={}),f;function f(){var n,o,a,i;for(n=new Array(arguments.length),i=0;i<arguments.length;i++)n[i]=arguments[i];return a=t(n).toString(),u(e,a)?e[a]:(o=r.apply(null,n),e[a]=o,o)}}var m=f;export default m;
//# sourceMappingURL=memoize.js.map