respond-framework
Version:
create as fast you think
15 lines (14 loc) • 553 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.inferArgName = exports.applyArgName = void 0;
const inferArgName = (response, value) => Object.defineProperty(response, '__argName', {
value,
enumerable: false
}); // automagic: dispatched events with response as arg value will move from eg: arg to arg.user
exports.inferArgName = inferArgName;
const applyArgName = arg => arg?.__argName ? {
[arg.__argName]: arg
} : arg; // applied to e object, and now ready for dispatch
exports.applyArgName = applyArgName;