kenya-locations
Version:
A comprehensive and intuitive TypeScript package for working with Kenyan administrative divisions (counties, sub-counties, constituencies, and wards)
45 lines (44 loc) • 1.16 kB
JavaScript
import { s as e } from "./sub-counties-Crb1ccMT.js";
import { c } from "./counties-CIvO8NBl.js";
import { w as C } from "./wards-CGdGn1Pj.js";
import { b as n, a as y } from "./maps-Bqmru5Ek.js";
const g = n(c, (t) => t.code), r = n(c, (t) => t.name.toLowerCase()), a = n(e, (t) => t.code), s = n(
e,
(t) => t.name.toLowerCase()
), u = y(e, (t) => {
var o;
return (o = g.get(t.county) ?? r.get(t.county.toLowerCase())) == null ? void 0 : o.code;
});
function m() {
return e;
}
function L(t) {
return a.get(t);
}
function d(t) {
return s.get(t.toLowerCase());
}
function M(t) {
if (u.has(t))
return u.get(t) ?? [];
const o = r.get(t.toLowerCase());
return o ? u.get(o.code) ?? [] : [];
}
function S(t) {
const o = s.get(t.toLowerCase());
return o ? r.get(o.county.toLowerCase()) : void 0;
}
function l(t) {
const o = a.get(t) ?? s.get(t.toLowerCase());
return o ? C.filter(
(i) => i.constituency.toLowerCase() === o.name.toLowerCase()
) : [];
}
export {
S as getCountyOfSubCounty,
m as getSubCounties,
M as getSubCountiesInCounty,
L as getSubCountyByCode,
d as getSubCountyByName,
l as getWardsInSubCounty
};