Skip to content

Commit 9e37f8f

Browse files
committed
Add a mapping from an org to its short identifier
1 parent add006d commit 9e37f8f

File tree

4 files changed

+48
-3
lines changed

4 files changed

+48
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@acm-uiuc/js-shared",
3-
"version": "2.3.0",
3+
"version": "2.4.0",
44
"description": "ACM UIUC Shared JS code",
55
"main": "dist/index.js",
66
"module": "dist/index.js",

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export * from "./orgs";
2-
export * from "./constants"
2+
export * from "./constants";
3+
export * from "./util";

src/orgs.ts

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { EnsureUniqueValues } from "util";
2+
13
export const SIGList = [
24
"SIGPwny",
35
"SIGCHI",
@@ -32,4 +34,36 @@ export const CommitteePartnerList = ["Reflections | Projections", "HackIllinois"
3234

3335
export const CoreOrganizationList = ["ACM", ...SIGList, ...CommitteeCoreList] as [string, ...string[]];
3436

35-
export const AllOrganizationList = [...CoreOrganizationList, ...CommitteePartnerList] as [string, ...string[]];
37+
export const AllOrganizationList = [...CoreOrganizationList, ...CommitteePartnerList] as [string, ...string[]];
38+
39+
export type ACMOrganization = typeof AllOrganizationList[number];
40+
41+
export const OrganizationShortIdentifierMapping = {
42+
"ACM": "acm",
43+
"SIGPwny": "sigpwny",
44+
"SIGCHI": "sigchi",
45+
"GameBuilders": "gamebuilders",
46+
"SIGAIDA": "sigaida",
47+
"SIGGRAPH": "siggraph",
48+
"ICPC": "icpc",
49+
"SIGMobile": "sigmobile",
50+
"SIGMusic": "sigmusic",
51+
"GLUG": "glug",
52+
"SIGNLL": "signll",
53+
"SIGma": "sigma",
54+
"SIGQuantum": "sigquantum",
55+
"SIGecom": "sigecom",
56+
"SIGPLAN": "sigplan",
57+
"SIGPolicy": "sigpolicy",
58+
"SIGARCH": "sigarch",
59+
"SIGRobotics": "sigrobotics",
60+
"SIGtricity": "sigtricity",
61+
"Infrastructure Committee": "infra",
62+
"Social Committee": "social",
63+
"Mentorship Committee": "mentorship",
64+
"Academic Committee": "academic",
65+
"Corporate Committee": "corporate",
66+
"Marketing Committee": "marketing",
67+
"Reflections | Projections": "reflproj",
68+
"HackIllinois": "hackillinois",
69+
} as const satisfies EnsureUniqueValues<Record<ACMOrganization, string>>;

src/util.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
type ValueOf<T> = T[keyof T];
3+
4+
export type EnsureUniqueValues<T extends Record<string, string>> = {
5+
[K in keyof T]: ValueOf<T> extends T[K]
6+
? T[K] extends ValueOf<Omit<T, K>>
7+
? never
8+
: T[K]
9+
: T[K]
10+
};

0 commit comments

Comments
 (0)