UNPKG

@naktibalda/stub-azure-function-context

Version:
27 lines 926 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.extractBindings = void 0; function extractBindings(bindingDefinitions) { const { triggers, inputs, outputs } = bindingDefinitions.reduce((definitions, next) => { if (next.type.toLowerCase().endsWith('trigger')) { definitions.triggers.push(next); } else if (next.direction === 'in') { definitions.inputs.push(next); } else if (next.direction === 'out') { definitions.outputs.push(next); } return definitions; }, { inputs: [], outputs: [], triggers: [] }); if (triggers.length > 1) { throw new Error('Invalid binding definition, only one trigger can be defined'); } return { trigger: triggers[0], inputs, outputs, }; } exports.extractBindings = extractBindings; //# sourceMappingURL=utils.js.map