smartstring/ts/smartstring.docker.ts

19 lines
538 B
TypeScript
Raw Permalink Normal View History

2022-03-18 21:50:24 +00:00
import * as plugins from './smartstring.plugins.js';
/**
* converts an erray of env strings from docker remote api to an usable object.
* @param envArrayArg
* @returns {}
*/
2020-12-31 03:56:40 +00:00
export const makeEnvObject = function (envArrayArg: string[]) {
let returnObject = {};
let regexString = /(.*)=(.*)/;
2017-10-05 13:55:59 +00:00
if (typeof envArrayArg !== 'undefined') {
for (let envKey in envArrayArg) {
let regexMatches = regexString.exec(envArrayArg[envKey]);
returnObject[regexMatches[1]] = regexMatches[2];
2016-08-03 13:41:36 +00:00
}
2017-10-05 13:55:59 +00:00
}
return returnObject;
};