When I send 0 as the index parameter, it returns an array rather than a string. This is because the index parameter is null in the "split" method.
module.exports = ({ params }) => {
const [value, delimiter, index] = params;
return {
value:
typeof index === 'number'
? value.split(delimiter)[index]
: value.split(delimiter),
};
};
The configuration I'm using is:
provider:
...
environment:
...
VAR_ONE: ${split("var_one_value/var_two_value", '/', 1)}
VAR_TWO: ${split("var_one_value/var_two_value", '/', 0)}
When I access those two variables I receive:
VAR_ONE = var_one_value
VAR_TWO = var_one_value,var_two_value
Environment:
Plugin version: "serverless-plugin-utils": "^0.2.0",
Framework version: "serverless": "^3.27.0",
When I send 0 as the index parameter, it returns an array rather than a string. This is because the index parameter is null in the "split" method.
The configuration I'm using is:
When I access those two variables I receive:
Environment:
Plugin version: "serverless-plugin-utils": "^0.2.0",
Framework version: "serverless": "^3.27.0",