From 581c8453c2d1bf7c8dce115a626f308b0e810d72 Mon Sep 17 00:00:00 2001 From: Anton Morev Date: Sun, 31 May 2020 22:34:53 +0300 Subject: [PATCH] Add posibility to extend context Now we can use stage config property useNameAsObject and add a result as new property to context. Usefull if we have multiple similar task with different results --- src/index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index bbc41d7..7fd65e0 100644 --- a/src/index.js +++ b/src/index.js @@ -70,7 +70,14 @@ const invokeStage = (fn, config) => { // Append the props to context. let appended; if (R.is(Object, props)) { - appended = ctx.appendToContext(context, props); + let resultProps; + if (config.useNameAsObject) { + resultProps = {} + resultProps[config.name] = props + } else { + resultProps = props + } + appended = ctx.appendToContext(context, resultProps) } else { const w = {}; w[config.name] = props; @@ -149,4 +156,4 @@ function createPipeline(...args) { return addConfigurationUtils(f, plConfig); } -module.exports = createPipeline; \ No newline at end of file +module.exports = createPipeline;