kenya-locations
Version:
A comprehensive and intuitive TypeScript package for working with Kenyan administrative divisions (counties, sub-counties, constituencies, and wards)
2 lines (1 loc) • 1.69 kB
JavaScript
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./wards-BHJ3nhLv.cjs"),i=require("./counties-D9ZfM1Ad.cjs"),d=require("./constituencies-HrhCXHyg.cjs"),y=require("./sub-counties-BGJlbhdB.cjs"),n=require("./maps-B_hwSl98.cjs"),C=require("./constituencies.cjs"),r=n.buildLookupMap(u.wards,t=>t.code),s=n.buildLookupMap(u.wards,t=>t.name.toLowerCase()),p=n.buildLookupMap(i.counties,t=>t.code),a=n.buildLookupMap(i.counties,t=>t.name.toLowerCase()),g=n.buildLookupMap(d.constituencies,t=>t.name.toLowerCase()),w=n.buildLookupMap(y.subCounties,t=>t.name.toLowerCase()),f=new Map(d.constituencies.flatMap(t=>{var o;const e=(o=a.get(t.county.toLowerCase()))==null?void 0:o.code;return e?[[t.code,e],[t.name,e]]:[]})),c=n.buildGroupMap(u.wards,t=>{var o;const e=g.get(t.constituency.toLowerCase());return e?(o=a.get(e.county.toLowerCase()))==null?void 0:o.code:void 0});function L(){return u.wards}function M(t){return r.get(t)}function W(t){return s.get(t.toLowerCase())}function b(t){if(c.has(t))return c.get(t)??[];const e=a.get(t.toLowerCase());return e?c.get(e.code)??[]:[]}function l(t){const e=r.get(t)??s.get(t.toLowerCase());if(!e)return;const o=f.get(e.constituency);return o?p.get(o):void 0}function m(t){const e=r.get(t)??s.get(t.toLowerCase());if(!e)return;const o=g.get(e.constituency.toLowerCase());return o?new C.ConstituencyWrapper(o):void 0}function v(t){const e=r.get(t)??s.get(t.toLowerCase());if(e)return w.get(e.constituency.toLowerCase())}exports.getConstituencyOfWard=m;exports.getCountyOfWard=l;exports.getSubCountyOfWard=v;exports.getWardByCode=M;exports.getWardByName=W;exports.getWards=L;exports.getWardsInCounty=b;