Files
bruno/packages/bruno-js/src/interpolate-string.js
lohit ab9bcbe5ed feat/rename collectionVariables variable name to runtimeVariables (#2638)
* pr review changes

* collection root object in export json

* import environment updates

* tests run execution order fix for collection runs

* updated validations

* collectionVariables -> runtimeVariables

* removed husky, adjusted indentation

---------

Co-authored-by: Anoop M D <anoop.md1421@gmail.com>
2024-07-17 17:21:03 +05:30

28 lines
521 B
JavaScript

const { interpolate } = require('@usebruno/common');
const interpolateString = (
str,
{ envVariables = {}, runtimeVariables = {}, processEnvVars = {}, requestVariables = {} }
) => {
if (!str || !str.length || typeof str !== 'string') {
return str;
}
const combinedVars = {
...envVariables,
...requestVariables,
...runtimeVariables,
process: {
env: {
...processEnvVars
}
}
};
return interpolate(str, combinedVars);
};
module.exports = {
interpolateString
};