UNPKG

raid-addons

Version:

Add-ons functions for use with Raid

37 lines (29 loc) 688 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var squash = function squash(key) { return function (update) { return function (state, event) { if (event.type !== key) { return state; } return update(state, event.payload); }; }; }; var compress = function compress(updates) { if (typeof updates === 'string') { return squash(updates); } return function (state, event, signal) { var update = updates[event.type]; if (update) { return update(state, event.payload, signal); } return state; }; }; var _default = compress; exports["default"] = _default;