mirror of
https://github.com/hashicorp/vault-action.git
synced 2025-11-06 23:06:54 +00:00
* Revert "update got dependency and convert to esm module (#533)"
This reverts commit 77efb36ae3.
* keep new local test file changes
* keep changes to PR template
* update changelog
19 lines
444 B
JavaScript
19 lines
444 B
JavaScript
/**
|
|
* Replaces any dot chars to __ and removes non-ascii charts
|
|
* @param {string} dataKey
|
|
* @param {boolean=} isEnvVar
|
|
*/
|
|
function normalizeOutputKey(dataKey, isEnvVar = false) {
|
|
let outputKey = dataKey
|
|
.replace(".", "__")
|
|
.replace(new RegExp("-", "g"), "")
|
|
.replace(/[^\p{L}\p{N}_-]/gu, "");
|
|
if (isEnvVar) {
|
|
outputKey = outputKey.toUpperCase();
|
|
}
|
|
return outputKey;
|
|
}
|
|
|
|
module.exports = {
|
|
normalizeOutputKey
|
|
};
|