UNPKG

country-state-city-js

Version:

A fast & light weight JS library to get countries geographical information including states, cities, iso codes, etc.

24 lines 770 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CityLite = exports.City = void 0; var utils_1 = require("../utils"); exports.City = cityHandler(); exports.CityLite = cityHandler('lite'); function cityHandler(type) { var fn = function (cointryIso2, stateIso) { if (!cointryIso2) { throw new TypeError("Country iso2 type missing"); } if (!stateIso) { throw new TypeError("State iso type missing"); } try { return require((type === 'lite' ? utils_1.PATH_LITE : utils_1.PATH) + "/cities/" + cointryIso2 + "/" + stateIso + "/index.json"); } catch (e) { return []; } }; return fn; } //# sourceMappingURL=city.js.map