export function initialize3dArray(x, y, z, initialValue = undefined) {
  return  Array.from({ length: x })
      .fill(null)
      .map(() => Array.from({ length: y })
          .fill(null)
          .map(() => Array.from({ length: z }).fill(initialValue))
      );
}

export function objectKeepKeys(object, ...keys) {
  if (Array.isArray(keys[0])) keys = keys[0];
  return Object.fromEntries(
      keys
          .filter(k => k in object)
          .map(k => [ k, object[k] ])
  );
}
