diff --git a/src/helpers/dataProcessor.js b/src/helpers/dataProcessor.js index 67db491..5df6d27 100644 --- a/src/helpers/dataProcessor.js +++ b/src/helpers/dataProcessor.js @@ -101,7 +101,7 @@ const dataProcessor = { values.push(typeof value === 'undefined' ? raw : value); } if (refType === 'F') { - const [handlerName, ..._args] = refValue.split(':'); + const [handlerName, ..._args] = refValue.split(/:(.*)/); const handlerFun = handler.getDataFuncHandler(handlerName); const handler_data = handlerFun({ args: _args.length > 0 ? _args[0].split(',') : _args }); values.push(this.processDataRefs(handler_data)); diff --git a/test/unit/dataProcessor.spec.js b/test/unit/dataProcessor.spec.js index 7e6a12e..8b6c1d3 100644 --- a/test/unit/dataProcessor.spec.js +++ b/test/unit/dataProcessor.spec.js @@ -963,6 +963,24 @@ describe('Data Processing - Functions', () => { expect(data).deep.equals({ name: 'Jon' }); }); + it('should return data passed in as parameter', () => { + handler.addDataFuncHandler('GetParam', (ctx) => { + return ctx.args[0] + }); + + const data = dp.processData('$F{GetParam:Jon}'); + expect(data).equals('Jon'); + }); + + it('should return data passed in as parameter with semicolon', () => { + handler.addDataFuncHandler('GetParam', (ctx) => { + return ctx.args[0] + }); + + const data = dp.processData('$F{GetParam:Jon:Doe}'); + expect(data).equals('Jon:Doe'); + }); + afterEach(() => { config.data.ref.map.enabled = false; config.data.ref.map.processed = false;