UNPKG

respond-framework

Version:
15 lines (14 loc) 553 B
"use strict"; 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;