Uname: Linux business55.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
Software: LiteSpeed
PHP version: 8.1.32 [ PHP INFO ] PHP os: Linux
Server Ip: 162.213.251.212
Your Ip: 3.144.105.204
User: allssztx (535) | Group: allssztx (533)
Safe Mode: OFF
Disable Function:
NONE

name : compilecountries.js
const cl = require('../src/countries-list')
const csc = require('../src/country-state-city')
const fs = require('fs')

let newlist = {}

cscCountries = csc.getAllCountries()

newlist = cl.countries
for (var key in newlist) {
  console.log(key)
  let i = 0;
  found = false;
  let cscCountryId = null
  while (!found && i < cscCountries.length) {
    if (cscCountries[i].sortname === key) {
      found = true
      cscCountryId = cscCountries[i].id
    }
    i++
  }
  let states = csc.getStatesOfCountry(cscCountryId)
  let cities = null
  newlist[key].states = {}
  for (var idx in states) {
    cities = csc.getCitiesOfState(states[idx].id)
    newlist[key].states[states[idx].name] = cities
  }
}
fs.writeFileSync('compiledCities.json', JSON.stringify(newlist))
© 2025 GrazzMean-Shell