Files
djhackersdev_minime/src/idz/encoder/loadProfile.ts
T
2019-11-06 17:28:30 -05:00

23 lines
553 B
TypeScript

import { loadProfile1 } from "./loadProfile1";
import { loadProfile2 } from "./loadProfile2";
import { loadProfile3 } from "./loadProfile3";
import { LoadProfileResponse } from "../response/loadProfile";
export function loadProfile(res: LoadProfileResponse) {
switch (res.format) {
case 1:
return loadProfile1(res);
case 2:
return loadProfile2(res);
case 3:
return loadProfile3(res);
default:
const exhaust: never = res;
throw new Error(`Unsupported profile response format ${res["format"]}`);
}
}