china-railway-station 1.0.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -15
- package/build/index.cjs +1 -1
- package/build/index.d.cts +38 -34
- package/build/index.d.ts +38 -34
- package/build/index.iife.js +1 -1
- package/build/index.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -16,7 +16,10 @@
|
|
|
16
16
|
```html
|
|
17
17
|
<script src="build/index.iife.js"></script>
|
|
18
18
|
<script>
|
|
19
|
-
ChinaRailwayStation
|
|
19
|
+
const station = new ChinaRailwayStation();
|
|
20
|
+
|
|
21
|
+
station.list; // 全部车站列表
|
|
22
|
+
station.find("北京西"); // 获取 北京西 相关车站
|
|
20
23
|
</script>
|
|
21
24
|
```
|
|
22
25
|
### ES Module
|
|
@@ -26,8 +29,12 @@ npm i china-railway-station
|
|
|
26
29
|
```
|
|
27
30
|
引用依赖:
|
|
28
31
|
```javascript
|
|
29
|
-
import
|
|
30
|
-
|
|
32
|
+
import ChinaRailwayStation from "china-railway-station";
|
|
33
|
+
|
|
34
|
+
const station = new ChinaRailwayStation();
|
|
35
|
+
|
|
36
|
+
station.list; // 全部车站列表
|
|
37
|
+
station.find("北京西"); // 获取 北京西 相关车站
|
|
31
38
|
```
|
|
32
39
|
### CommonJS
|
|
33
40
|
安装依赖:
|
|
@@ -36,18 +43,23 @@ npm i china-railway-station
|
|
|
36
43
|
```
|
|
37
44
|
引用依赖:
|
|
38
45
|
```javascript
|
|
39
|
-
const
|
|
40
|
-
|
|
46
|
+
const ChinaRailwayStation = require("china-railway-station");
|
|
47
|
+
|
|
48
|
+
const station = new ChinaRailwayStation();
|
|
49
|
+
|
|
50
|
+
station.list; // 全部车站列表
|
|
51
|
+
station.find("北京西"); // 获取 北京西 相关车站
|
|
41
52
|
```
|
|
42
|
-
##
|
|
43
|
-
####
|
|
53
|
+
## 属性、方法
|
|
54
|
+
#### list
|
|
44
55
|
获取车站全部列表
|
|
45
|
-
-
|
|
46
|
-
####
|
|
56
|
+
- 类型:`Station[]`
|
|
57
|
+
#### group
|
|
47
58
|
获取车站全部列表(城市分组格式)
|
|
48
|
-
-
|
|
49
|
-
####
|
|
59
|
+
- 类型:`Record<string, Station[]>`
|
|
60
|
+
#### find
|
|
50
61
|
模糊搜索车站
|
|
62
|
+
- 类型:`function`
|
|
51
63
|
- 参数:
|
|
52
64
|
|
|
53
65
|
| 参数名 | 类型 | 是否可选 | 默认值 | 说明 |
|
|
@@ -55,8 +67,9 @@ getList();
|
|
|
55
67
|
| keyword | `string` | 否 | - | 搜索关键词 |
|
|
56
68
|
|
|
57
69
|
- 返回值:`Station[]`
|
|
58
|
-
####
|
|
70
|
+
#### findByName
|
|
59
71
|
通过车站名获取车站信息
|
|
72
|
+
- 类型:`function`
|
|
60
73
|
- 参数:
|
|
61
74
|
|
|
62
75
|
| 参数名 | 类型 | 是否可选 | 默认值 | 说明 |
|
|
@@ -64,8 +77,9 @@ getList();
|
|
|
64
77
|
| name | `string` | 否 | - | 车站名 |
|
|
65
78
|
|
|
66
79
|
- 返回值:`Station | undefined`
|
|
67
|
-
####
|
|
80
|
+
#### findByTelecode
|
|
68
81
|
通过电报码获取车站信息
|
|
82
|
+
- 类型:`function`
|
|
69
83
|
- 参数:
|
|
70
84
|
|
|
71
85
|
| 参数名 | 类型 | 是否可选 | 默认值 | 说明 |
|
|
@@ -73,8 +87,9 @@ getList();
|
|
|
73
87
|
| telecode | `string` | 否 | - | 电报码 |
|
|
74
88
|
|
|
75
89
|
- 返回值:`Station | undefined`
|
|
76
|
-
####
|
|
90
|
+
#### findByPinyinCode
|
|
77
91
|
通过拼音码获取车站信息
|
|
92
|
+
- 类型:`function`
|
|
78
93
|
- 参数:
|
|
79
94
|
|
|
80
95
|
| 参数名 | 类型 | 是否可选 | 默认值 | 说明 |
|
|
@@ -82,8 +97,9 @@ getList();
|
|
|
82
97
|
| pinyinCode | `string` | 否 | - | 拼音码 |
|
|
83
98
|
|
|
84
99
|
- 返回值:`Station[]`
|
|
85
|
-
####
|
|
100
|
+
#### findByCity
|
|
86
101
|
通过城市名或城市编码获取车站信息
|
|
102
|
+
- 类型:`function`
|
|
87
103
|
- 参数:
|
|
88
104
|
|
|
89
105
|
| 参数名 | 类型 | 是否可选 | 默认值 | 说明 |
|