21 lines
623 B
TypeScript
21 lines
623 B
TypeScript
import * as plugins from './smartstring.plugins.js';
|
|
|
|
/**
|
|
* converts an erray of env strings from docker remote api to an usable object.
|
|
* @param envArrayArg
|
|
* @returns {}
|
|
*/
|
|
export const makeEnvObject = function (envArrayArg: string[]): Record<string, string> {
|
|
const returnObject: Record<string, string> = {};
|
|
const regexString = /(.*)=(.*)/;
|
|
if (typeof envArrayArg !== 'undefined') {
|
|
for (const envString of envArrayArg) {
|
|
const regexMatches = regexString.exec(envString);
|
|
if (regexMatches) {
|
|
returnObject[regexMatches[1]] = regexMatches[2];
|
|
}
|
|
}
|
|
}
|
|
return returnObject;
|
|
};
|