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.17 kB
JavaScript
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./sub-counties-BGJlbhdB.cjs"),c=require("./counties-D9ZfM1Ad.cjs"),a=require("./wards-BHJ3nhLv.cjs"),e=require("./maps-B_hwSl98.cjs"),y=e.buildLookupMap(c.counties,t=>t.code),s=e.buildLookupMap(c.counties,t=>t.name.toLowerCase()),i=e.buildLookupMap(u.subCounties,t=>t.code),r=e.buildLookupMap(u.subCounties,t=>t.name.toLowerCase()),n=e.buildGroupMap(u.subCounties,t=>{var o;return(o=y.get(t.county)??s.get(t.county.toLowerCase()))==null?void 0:o.code});function b(){return u.subCounties}function g(t){return i.get(t)}function d(t){return r.get(t.toLowerCase())}function p(t){if(n.has(t))return n.get(t)??[];const o=s.get(t.toLowerCase());return o?n.get(o.code)??[]:[]}function S(t){const o=r.get(t.toLowerCase());return o?s.get(o.county.toLowerCase()):void 0}function L(t){const o=i.get(t)??r.get(t.toLowerCase());return o?a.wards.filter(C=>C.constituency.toLowerCase()===o.name.toLowerCase()):[]}exports.getCountyOfSubCounty=S;exports.getSubCounties=b;exports.getSubCountiesInCounty=p;exports.getSubCountyByCode=g;exports.getSubCountyByName=d;exports.getWardsInSubCounty=L;