UNPKG

kenya-locations

Version:

A comprehensive and intuitive TypeScript package for working with Kenyan administrative divisions (counties, sub-counties, constituencies, and wards)

68 lines (67 loc) 1.77 kB
import { w as r } from "./wards-CGdGn1Pj.js"; import { c as i } from "./counties-CIvO8NBl.js"; import { c as d } from "./constituencies-CpiSuj07.js"; import { s as p } from "./sub-counties-Crb1ccMT.js"; import { b as n, a as C } from "./maps-Bqmru5Ek.js"; import { ConstituencyWrapper as f } from "./constituencies.js"; const s = n(r, (t) => t.code), c = n(r, (t) => t.name.toLowerCase()), y = n(i, (t) => t.code), u = n(i, (t) => t.name.toLowerCase()), g = n( d, (t) => t.name.toLowerCase() ), w = n( p, (t) => t.name.toLowerCase() ), m = new Map( d.flatMap((t) => { var e; const o = (e = u.get(t.county.toLowerCase())) == null ? void 0 : e.code; return o ? [ [t.code, o], [t.name, o] ] : []; }) ), a = C(r, (t) => { var e; const o = g.get(t.constituency.toLowerCase()); return o ? (e = u.get(o.county.toLowerCase())) == null ? void 0 : e.code : void 0; }); function B() { return r; } function T(t) { return s.get(t); } function h(t) { return c.get(t.toLowerCase()); } function k(t) { if (a.has(t)) return a.get(t) ?? []; const o = u.get(t.toLowerCase()); return o ? a.get(o.code) ?? [] : []; } function x(t) { const o = s.get(t) ?? c.get(t.toLowerCase()); if (!o) return; const e = m.get(o.constituency); return e ? y.get(e) : void 0; } function G(t) { const o = s.get(t) ?? c.get(t.toLowerCase()); if (!o) return; const e = g.get(o.constituency.toLowerCase()); return e ? new f(e) : void 0; } function I(t) { const o = s.get(t) ?? c.get(t.toLowerCase()); if (o) return w.get(o.constituency.toLowerCase()); } export { G as getConstituencyOfWard, x as getCountyOfWard, I as getSubCountyOfWard, T as getWardByCode, h as getWardByName, B as getWards, k as getWardsInCounty };