1.1.13 • Published 5 years ago

ydd_area v1.1.13

Weekly downloads
2
License
ISC
Repository
-
Last release
5 years ago

china city options for 运达达 app

getAllChild

get one deep children by code

getAllChild(320000);
[
    {name:"南京",code:"320100",lat:"32.055645",lon:"118.797741",parent:"320000"},
    {name:"无锡",code:"320200",lat:"31.526047",lon:"120.31968",parent:"320000"},
    ...
]
getAllChild(320100);
[
    {name:"玄武",code:"320102",lat:"32.054918",lon:"118.845366",parent:"320100"},
    ...
]
getAllRoots

get all province items

getAllRoots();
[
    {name:"北京市",code:"110000",lon:"116.397947",lat:"39.908173"},
    ...
]
getItemByCode

get detail by code

getItemByCode(710100)
{name: "台湾",code: "710100",lon: "120.958132",lat: "23.851606",parent: "710000"}
getCodeByName

get code by similarity name

getCodeByName("北京");
110000
getNameByCode

get name by code, reverse of getCodeByName

getNameByCode(710101);
"中西区"
getPathByCode

get total detail by code

getPathByCode(542122)
[
    {name:"西藏",code:"540000",lon:"91.13205",lat:"29.657589"},
    {name:"昌都",code:"542100",lon:"97.150265",lat:"31.181562",parent:"540000"},
    {name:"江达",code:"542122",lon:"98.218428",lat:"31.499202",parent:"542100"}
]
getParentByCode

get parent detail by code

getParentByCode(110100);
{name:"北京市",code:"110000",lon:"116.397947",lat:"39.908173"}
getFullName

get full name by code

/*
*@code
*@[deep=3] 1:省 2:市 3:区
*@[connectChar]
*/
getFullName(320102,3,"-");
"江苏-南京-玄武"
getFullName(320102,2,"-");
"江苏-南京"
getFlatTree

get flat data as { value,name,parent }

getFlatTree()
[
    {value:"5212",name:"梅河口",parent:"220000"},
    {value:"6420",name:"铁门关市",parent:"650000"},
    ...
]
codesToDisplay

translate codes to display, if one code is child, find it's parent and joint to 'province(city|area)'

codesToDisplay([320200,320102,320103,320100,210000])
"江苏(无锡,玄武,白下,南京);辽宁"
codeToFullNameArr

translate code to full name array, second param is deep, default 3

codeToFullNameArr(320200)
["江苏", "南京", "白下"]
codeToFullNameArr(320200,2)
["南京", "白下"]
codeToFullNameArr(320200,1)
["白下"]
1.1.13

5 years ago

1.1.12

5 years ago

1.1.11

5 years ago

1.1.10

5 years ago

1.1.9

5 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago