@acm-uiuc/js-shared 3.0.0 → 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 CHANGED
@@ -141,9 +141,14 @@ export declare const Organizations: {
141
141
  readonly shortcode: "hackillinois";
142
142
  };
143
143
  };
144
+ export declare const AllOrganizationNameList: ("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")[];
144
145
  export type OrganizationId = keyof typeof Organizations;
145
146
  export type Organization = (typeof Organizations)[OrganizationId];
146
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;
147
152
  export declare function getOrgsByType(type: OrgType): Array<Organization & {
148
153
  id: OrganizationId;
149
154
  }>;
package/dist/orgs.js CHANGED
@@ -34,6 +34,21 @@ export const Organizations = {
34
34
  "C07": { name: "Reflections | Projections", type: OrgType.COMMITTEE, shortcode: "reflproj" },
35
35
  "C08": { name: "HackIllinois", type: OrgType.COMMITTEE, shortcode: "hackillinois" },
36
36
  };
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
+ }
37
52
  export function getOrgsByType(type) {
38
53
  return Object.entries(Organizations)
39
54
  .filter(([_, org]) => org.type === type)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acm-uiuc/js-shared",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "ACM UIUC Shared JS code",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",