tangled
alpha
login
or
join now
finxol.io
/
hooks
0
fork
atom
Simple API gateway for webhooks
0
fork
atom
overview
issues
pulls
pipelines
feat: include country flag emoji
finxol.io
6 months ago
876f8692
e3adea51
verified
This commit was signed with the committer's
known signature
.
finxol.io
SSH Key Fingerprint:
SHA256:olFE3asYdoBMScuJOt60UxXdJ0RFdGv5kVKrdOtIcPI=
1/1
deploy.yaml
success
17s
+15
1 changed file
expand all
collapse all
unified
split
src
sensors.ts
+15
src/sensors.ts
···
178
178
return c.text("Invalid country data", 400)
179
179
}
180
180
181
181
+
const letterA = "a".codePointAt(0) as number
182
182
+
//biome-ignore format: breaks emoji
183
183
+
const regionalIndicatorA = "🇦".codePointAt(0) as number
184
184
+
185
185
+
const toRegionalIndicator = (char: string) =>
186
186
+
String.fromCodePoint(
187
187
+
char.codePointAt(0) as number - letterA + regionalIndicatorA,
188
188
+
)
189
189
+
190
190
+
const emoji = country.data.features[0].properties.country_code
191
191
+
.split("")
192
192
+
.map((char) => toRegionalIndicator(char))
193
193
+
.join("")
194
194
+
181
195
const ret = {
182
196
country: country.data.features[0].properties.country,
183
197
country_code: country.data.features[0].properties.country_code,
198
198
+
country_flag: emoji,
184
199
}
185
200
186
201
// Cache country data to KV store (expiry set for 2 hours)