paypal-custom-sdk
Version:
a minimalistic paypal sdk for custom integrations
17 lines (16 loc) • 463 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.withMemo = void 0;
const withMemo = (callback, memoTime) => {
let lastCallTime = 0;
let lastReturnValue;
return (...args) => {
const now = Date.now();
if (now - lastCallTime > memoTime) {
lastReturnValue = callback(...args);
lastCallTime = now;
}
return lastReturnValue;
};
};
exports.withMemo = withMemo;