Files
smartstring/ts/smartstring.docker.ts
T

21 lines
623 B
TypeScript
Raw Normal View History

2022-03-18 22:50:24 +01:00
import * as plugins from './smartstring.plugins.js';
2016-04-16 00:58:44 +02:00
/**
* 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 = /(.*)=(.*)/;
2017-10-05 15:55:59 +02:00
if (typeof envArrayArg !== 'undefined') {
for (const envString of envArrayArg) {
const regexMatches = regexString.exec(envString);
if (regexMatches) {
returnObject[regexMatches[1]] = regexMatches[2];
}
2016-08-03 15:41:36 +02:00
}
2017-10-05 15:55:59 +02:00
}
return returnObject;
};