export function mergePrincipal()

in lib/util.ts [68:81]


export function mergePrincipal(target: { [key: string]: string[] }, source: { [key: string]: string[] }) {
  for (const key of Object.keys(source)) {
    target[key] = target[key] || [];

    let value = source[key];
    if (!Array.isArray(value)) {
      value = [ value ];
    }

    target[key].push(...value);
  }

  return target;
}