smartstring/ts/smartstring.docker.ts

19 lines
536 B
TypeScript
Raw Normal View History

2016-10-31 23:22:38 +00:00
import * as plugins from './smartstring.plugins'
/**
* converts an erray of env strings from docker remote api to an usable object.
* @param envArrayArg
* @returns {}
*/
2017-10-26 13:24:10 +00:00
export const makeEnvObject = function (envArrayArg: string[]) {
2017-10-05 13:55:59 +00:00
let returnObject = {}
let regexString = /(.*)=(.*)/
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
2016-10-31 23:22:38 +00:00
}