switch-chinese 1.0.0 → 1.0.1
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/package.json +2 -1
- package/readme.md +22 -15
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "switch-chinese",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Convert between simplified and traditional Chinese characters",
|
|
5
5
|
"main": "stcasc.lib.js",
|
|
6
|
+
"type": "module",
|
|
6
7
|
"repository": {
|
|
7
8
|
"type": "git",
|
|
8
9
|
"url": "git+https://github.com/hoothin/UserScripts.git#master"
|
package/readme.md
CHANGED
|
@@ -7,40 +7,47 @@
|
|
|
7
7
|
+ 基礎用法
|
|
8
8
|
|
|
9
9
|
``` js
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
import Stcasc from './stcasc.lib.js';
|
|
11
|
+
let stcasc = Stcasc();
|
|
12
|
+
alert(stcasc.traditionalized("香烟 香烟袅袅 烟雾里 里长面子 吃干面 干 把考卷发回来 卷发"));
|
|
13
|
+
//香菸 香煙裊裊 煙霧裡 里長面子 吃乾麵 幹 把考卷發回來 捲髮
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
+ 透過 npm 安裝
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
npm install switch-chinese
|
|
20
|
+
import Stcasc from 'switch-chinese';
|
|
14
21
|
```
|
|
15
22
|
|
|
16
23
|
+ 轉正體中文
|
|
17
24
|
|
|
18
25
|
``` js
|
|
19
|
-
|
|
26
|
+
stcasc.traditionalized("中文");
|
|
20
27
|
```
|
|
21
28
|
|
|
22
29
|
+ 轉簡體中文
|
|
23
30
|
|
|
24
31
|
``` js
|
|
25
|
-
|
|
32
|
+
stcasc.simplized("中文");
|
|
26
33
|
```
|
|
27
34
|
|
|
28
35
|
+ 添加快取
|
|
29
36
|
|
|
30
37
|
``` js
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
38
|
+
let cache = loadCacheAtYourWay();
|
|
39
|
+
let stcasc = Stcasc(cache);
|
|
40
|
+
saveCacheAtYourWay(stcasc.cache);
|
|
34
41
|
```
|
|
35
42
|
|
|
36
43
|
+ 自訂簡繁切換
|
|
37
44
|
|
|
38
45
|
``` js
|
|
39
|
-
|
|
46
|
+
const custom = {
|
|
40
47
|
"身份": "身分",
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
"转义": "跳脫",
|
|
49
|
+
"转换": "轉檔",
|
|
50
|
+
"软件": "軟體"
|
|
51
|
+
};
|
|
52
|
+
let stcasc = Stcasc(cache, custom);
|
|
46
53
|
```
|