@shopgate/engage
Version:
Shopgate's ENGAGE library.
12 lines • 322 B
JavaScript
/**
* Memoization test
* @param {Function} selector selector
* @returns {Function}
*/
export const wrapMemoizedSelector = selector => (...args) => {
const result = selector.apply(void 0, args);
if (selector.apply(void 0, args) !== result) {
throw new Error('Memoization check failed.');
}
return result;
};