@acm-uiuc/js-shared 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/orgs.d.ts +4 -0
- package/dist/orgs.js +14 -0
- package/package.json +1 -1
package/dist/orgs.d.ts
CHANGED
|
@@ -145,6 +145,10 @@ export declare const AllOrganizationNameList: ("ACM" | "SIGPwny" | "SIGCHI" | "G
|
|
|
145
145
|
export type OrganizationId = keyof typeof Organizations;
|
|
146
146
|
export type Organization = (typeof Organizations)[OrganizationId];
|
|
147
147
|
export type OrganizationName = Organization["name"];
|
|
148
|
+
export declare const OrganizationsByName: Record<"ACM" | "SIGPwny" | "SIGCHI" | "GameBuilders" | "SIGAIDA" | "SIGGRAPH" | "ICPC" | "SIGMobile" | "SIGMusic" | "GLUG" | "SIGNLL" | "SIGma" | "SIGQuantum" | "SIGecom" | "SIGPLAN" | "SIGPolicy" | "SIGARCH" | "SIGRobotics" | "SIGtricity" | "Infrastructure Committee" | "Social Committee" | "Mentorship Committee" | "Academic Committee" | "Corporate Committee" | "Marketing Committee" | "Reflections | Projections" | "HackIllinois", "A01" | "S01" | "S02" | "S03" | "S04" | "S05" | "S06" | "S07" | "S08" | "S09" | "S10" | "S11" | "S12" | "S13" | "S14" | "S15" | "S16" | "S17" | "S18" | "C01" | "C02" | "C03" | "C04" | "C05" | "C06" | "C07" | "C08">;
|
|
149
|
+
export declare function getOrgByName(name: OrganizationName): (Organization & {
|
|
150
|
+
id: OrganizationId;
|
|
151
|
+
}) | undefined;
|
|
148
152
|
export declare function getOrgsByType(type: OrgType): Array<Organization & {
|
|
149
153
|
id: OrganizationId;
|
|
150
154
|
}>;
|
package/dist/orgs.js
CHANGED
|
@@ -35,6 +35,20 @@ export const Organizations = {
|
|
|
35
35
|
"C08": { name: "HackIllinois", type: OrgType.COMMITTEE, shortcode: "hackillinois" },
|
|
36
36
|
};
|
|
37
37
|
export const AllOrganizationNameList = Object.values(Organizations).map(x => x.name);
|
|
38
|
+
// Create a reverse lookup map from name to ID
|
|
39
|
+
export const OrganizationsByName = Object.entries(Organizations).reduce((acc, [id, org]) => {
|
|
40
|
+
if (acc[org.name]) {
|
|
41
|
+
throw new Error(`Duplicate organization name: ${org.name}`);
|
|
42
|
+
}
|
|
43
|
+
acc[org.name] = id;
|
|
44
|
+
return acc;
|
|
45
|
+
}, {});
|
|
46
|
+
export function getOrgByName(name) {
|
|
47
|
+
const id = OrganizationsByName[name];
|
|
48
|
+
if (!id)
|
|
49
|
+
return undefined;
|
|
50
|
+
return { ...Organizations[id], id };
|
|
51
|
+
}
|
|
38
52
|
export function getOrgsByType(type) {
|
|
39
53
|
return Object.entries(Organizations)
|
|
40
54
|
.filter(([_, org]) => org.type === type)
|