Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 756 Bytes

README.md

File metadata and controls

21 lines (15 loc) · 756 Bytes

location-china

数据源

数据源使用的统计用区划代码和城乡划分代码,可以在国家统计局官网查看。国家统计局每年都会更新代码,最早的数据是2009年,最新的是2023年

Province

toShort

public toShort() {
  // 如果是自治区,只取前两个字
  if (this.name.indexOf('自治区') !== -1) {
    return this.name.substr(0, 2)
  }

  // remove 省 | 市
  return this.name.replace(/[(\u7701)|(\u5E02)]/g, '')
}