extra parameter is added

This commit is contained in:
병준 박 2019-10-29 18:16:19 +09:00
parent e516d4b756
commit eef36fcb44

View File

@ -3,7 +3,11 @@ export type Parameter = {
} | null; } | null;
export class ParameterUtil { export class ParameterUtil {
public static encode(parameterMap: {}, param: {}): Parameter { public static encode(
parameterMap: {},
param: {},
extraParam?: {}
): Parameter {
const parameter: Parameter = {}; const parameter: Parameter = {};
Object.keys(parameterMap).map(key => { Object.keys(parameterMap).map(key => {
@ -13,6 +17,9 @@ export class ParameterUtil {
if (!!param[key]) { if (!!param[key]) {
parameter[parameterMap[key]] = param[key]; parameter[parameterMap[key]] = param[key];
} }
if (!!extraParam && !!extraParam[key]) {
parameter[parameterMap[key]] = extraParam[key];
}
}); });
return 0 === Object.keys(parameter).length ? null : parameter; return 0 === Object.keys(parameter).length ? null : parameter;