@node-novel/normalize 1.0.25 → 1.0.30
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/CHANGELOG.md +70 -0
- package/index.d.ts +1 -1
- package/index.js +6 -8
- package/index.js.map +1 -1
- package/package.json +9 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,76 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.0.30](https://github.com/bluelovers/ws-node-novel/compare/@node-novel/normalize@1.0.28...@node-novel/normalize@1.0.30) (2022-05-16)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### 🛠 Build System
|
|
10
|
+
|
|
11
|
+
* update typescript ([c16e9f8](https://github.com/bluelovers/ws-node-novel/commit/c16e9f83eb0ba558175485120a2e9334f80bcbd3))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### ♻️ Chores
|
|
15
|
+
|
|
16
|
+
* **deps:** update deps ([60c8a11](https://github.com/bluelovers/ws-node-novel/commit/60c8a119f095ed04a4c28dcd1774e4e8f0970970))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### 🔖 Miscellaneous
|
|
20
|
+
|
|
21
|
+
* . ([57ee43d](https://github.com/bluelovers/ws-node-novel/commit/57ee43d121d63feb6ec6588641bebc7343a18342))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## [1.0.29](https://github.com/bluelovers/ws-node-novel/compare/@node-novel/normalize@1.0.28...@node-novel/normalize@1.0.29) (2022-05-16)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### 🛠 Build System
|
|
31
|
+
|
|
32
|
+
* update typescript ([c16e9f8](https://github.com/bluelovers/ws-node-novel/commit/c16e9f83eb0ba558175485120a2e9334f80bcbd3))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### ♻️ Chores
|
|
36
|
+
|
|
37
|
+
* **deps:** update deps ([60c8a11](https://github.com/bluelovers/ws-node-novel/commit/60c8a119f095ed04a4c28dcd1774e4e8f0970970))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## [1.0.28](https://github.com/bluelovers/ws-node-novel/compare/@node-novel/normalize@1.0.27...@node-novel/normalize@1.0.28) (2021-07-08)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### 🛠 Build System
|
|
47
|
+
|
|
48
|
+
* update deps and use tslib ([bc00796](https://github.com/bluelovers/ws-node-novel/commit/bc007968e0dde703a1b4e79d147bd7122fe3468b))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## [1.0.27](https://github.com/bluelovers/ws-node-novel/compare/@node-novel/normalize@1.0.26...@node-novel/normalize@1.0.27) (2021-02-12)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### 🛠 Build System
|
|
58
|
+
|
|
59
|
+
* update typescript ([90c2208](https://github.com/bluelovers/ws-node-novel/commit/90c22085d647eea8c5e8c4a24ca3dd63cbf784af))
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## [1.0.26](https://github.com/bluelovers/ws-node-novel/compare/@node-novel/normalize@1.0.25...@node-novel/normalize@1.0.26) (2021-02-12)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### ♻️ Chores
|
|
69
|
+
|
|
70
|
+
* **deps:** update deps ([1bc0925](https://github.com/bluelovers/ws-node-novel/commit/1bc09257c16754054103f3aec637dcf18f81f25a))
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
6
76
|
## [1.0.25](https://github.com/bluelovers/ws-node-novel/compare/@node-novel/normalize@1.0.24...@node-novel/normalize@1.0.25) (2020-08-13)
|
|
7
77
|
|
|
8
78
|
|
package/index.d.ts
CHANGED
|
@@ -7,5 +7,5 @@ export interface IOptions {
|
|
|
7
7
|
}
|
|
8
8
|
export declare function normalize_strip(str: string, isDir?: boolean): string;
|
|
9
9
|
export declare function normalize_val(str: string, padNum?: number, options?: IOptions): string;
|
|
10
|
-
declare const _default: typeof import("
|
|
10
|
+
declare const _default: typeof import("./index");
|
|
11
11
|
export default _default;
|
package/index.js
CHANGED
|
@@ -2,14 +2,12 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Created by user on 2018/2/14/014.
|
|
4
4
|
*/
|
|
5
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
7
|
-
};
|
|
8
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
6
|
exports.normalize_val = exports.normalize_strip = void 0;
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
const str_util_1 = tslib_1.__importDefault(require("str-util"));
|
|
9
|
+
const normalize_num_1 = tslib_1.__importDefault(require("normalize-num"));
|
|
10
|
+
const novel_filename_1 = tslib_1.__importDefault(require("@lazy-cjk/novel-filename"));
|
|
13
11
|
const zh_slugify_1 = require("@lazy-cjk/zh-slugify");
|
|
14
12
|
function normalize_strip(str, isDir) {
|
|
15
13
|
if (isDir) {
|
|
@@ -50,7 +48,7 @@ function normalize_val(str, padNum = 5, options = {}) {
|
|
|
50
48
|
flags: 'ug',
|
|
51
49
|
}).toString();
|
|
52
50
|
//console.log(str);
|
|
53
|
-
str = normalize_num_1.default(str, {
|
|
51
|
+
str = (0, normalize_num_1.default)(str, {
|
|
54
52
|
all: true,
|
|
55
53
|
roman: options.checkRoman,
|
|
56
54
|
});
|
|
@@ -101,7 +99,7 @@ function normalize_val(str, padNum = 5, options = {}) {
|
|
|
101
99
|
greedyTable: true,
|
|
102
100
|
})[0];
|
|
103
101
|
*/
|
|
104
|
-
str = zh_slugify_1.slugify(str, true);
|
|
102
|
+
str = (0, zh_slugify_1.slugify)(str, true);
|
|
105
103
|
return str;
|
|
106
104
|
}
|
|
107
105
|
exports.normalize_val = normalize_val;
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;GAEG
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,gEAA+B;AAC/B,0EAAoC;AAEpC,sFAAqD;AACrD,qDAA+C;AAQ/C,SAAgB,eAAe,CAAC,GAAW,EAAE,KAAe;IAE3D,IAAI,KAAK,EACT;QACC,IAAI,+BAA+B,CAAC,IAAI,CAAC,GAAG,CAAC,EAC7C;YACC,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC;SAChB;aACI,IAAI,gCAAgC,CAAC,IAAI,CAAC,GAAG,CAAC,EACnD;YACC,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC;SAChB;KACD;SAED;QACC,IAAI,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,EAC/B;YACC,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC;SAChB;aACI,IAAI,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,EACpC;YACC,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC;SAChB;KACD;IAED,GAAG,GAAG,kBAAO,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAE7B,OAAO,GAAG,CAAC;AACZ,CAAC;AA5BD,0CA4BC;AAED,SAAgB,aAAa,CAAC,GAAW,EAAE,SAAiB,CAAC,EAAE,UAAoB,EAAE;IAEpF,MAAM,GAAG,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;IAElC,wBAAwB;IAExB,GAAG,GAAG,wBAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAElC,IAAI,wBAAwB,CA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AG,CAAC;SACtB,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;SACnB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAEpB;IAED;;;;MAIE;IAEF;;;;;;;;;;MAUE;IAEF,GAAG,GAAG,IAAA,oBAAO,EAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAEzB,OAAO,GAAG,CAAC;AACZ,CAAC;AA9FD,sCA8FC;AAED,kBAAe,OAAmC,CAAC","sourcesContent":["/**\n * Created by user on 2018/2/14/014.\n */\n\nimport StrUtil from 'str-util';\nimport str2num from 'normalize-num';\n\nimport novelFilename from '@lazy-cjk/novel-filename';\nimport { slugify } from '@lazy-cjk/zh-slugify';\n\nexport interface IOptions\n{\n\tpadNum?: number,\n\tcheckRoman?: boolean,\n}\n\nexport function normalize_strip(str: string, isDir?: boolean)\n{\n\tif (isDir)\n\t{\n\t\tif (/^p?\\d{4,}[\\s_](.+)(_\\(\\d+\\))$/.exec(str))\n\t\t{\n\t\t\tstr = RegExp.$1;\n\t\t}\n\t\telse if (/^p?\\d{4,}[\\s_](.+)(_\\(\\d+\\))?$/.exec(str))\n\t\t{\n\t\t\tstr = RegExp.$1;\n\t\t}\n\t}\n\telse\n\t{\n\t\tif (/^\\d+_(.+)\\.\\d+$/.exec(str))\n\t\t{\n\t\t\tstr = RegExp.$1;\n\t\t}\n\t\telse if (/^c?\\d{4,}_(.+)$/.exec(str))\n\t\t{\n\t\t\tstr = RegExp.$1;\n\t\t}\n\t}\n\n\tstr = StrUtil.trim(str, ' ');\n\n\treturn str;\n}\n\nexport function normalize_val(str: string, padNum: number = 5, options: IOptions = {}): string\n{\n\tpadNum = padNum || options.padNum;\n\n\t//console.log(111, str);\n\n\tstr = novelFilename.filename(str);\n\n\tif (/^(?:序|プロローグ|Prologue)/i.test(str))\n\t{\n\t\tstr = '0_' + str;\n\t}\n\n\tstr = str.replace(/^(web)版(\\d+)/i, '$1$2');\n\n\t//str = str.replace(/^[cp](\\d{4,}_)/, '$1');\n\n\tstr = StrUtil.toHalfWidth(str)\n\t\t.toLowerCase()\n\t;\n\tstr = StrUtil.trim(str, ' ');\n\n\tstr = StrUtil.zh2num(str).toString();\n\n\tstr = StrUtil.zh2num(str, {\n\t\ttruncateOne: 2,\n\t\tflags: 'ug',\n\t}).toString();\n\n\t//console.log(str);\n\n\tstr = str2num(str, {\n\t\tall: true,\n\t\troman: options.checkRoman,\n\t});\n\n\t/*\n\tif (options.checkRoman)\n\t{\n\t\tlet m = isRoman(str);\n\n\t\tif (m)\n\t\t{\n\t\t\tlet n = deromanize(normalizeRoman(m[1]));\n\t\t\tstr = n.toString() + str.slice(m[1].length);\n\t\t\t//console.log(m[1], n, str);\n\t\t}\n\t}\n\n\tstr = circle2num(str);\n\t*/\n\n\tstr = str.replace(/\\d+/g, function ($0)\n\t{\n\t\treturn $0.padStart(padNum, '0');\n\t});\n\n\tstr = str\n\t\t.replace(/^第+/, '')\n\t\t//.replace(/(\\d)[章話]/g, '$1_')\n\t\t//.replace(/第(\\d)/g, '_$1')\n\t\t//.replace(/\\./g, '_')\n\t\t.replace(/[―—-──\\-―—─==―——─ー─]/g, '_')\n\t\t.replace(/[\\s ]/g, '_')\n\t\t.replace(/[\\(\\)〔[【《(「『』」》)】〕]〔[〕]]/g, '_')\n\t\t.replace(/[·‧・···•・·᛫•․‧∙⋅⸱⸳・ꞏ·‧・···•˙●‧﹒]/g, '_')\n\t\t.replace(/[::︰﹕:︓∶:]/ug, '_')\n\t\t.replace(/[・:,]/g, '_')\n\t\t.replace(/_+$/g, '')\n\t\t.replace(/_+/g, '_')\n\n\t;\n\n\t/*\n\tstr = zh2jp(cn2tw(str) as string, {\n\t\tsafe: false,\n\t});\n\t*/\n\n\t/*\n\tstr = zhTable.auto(cn2tw(str, {\n\t\tsafe: false,\n\t\t// @ts-ignore\n\t\tgreedyTable: true,\n\t}), {\n\t\tsafe: false,\n\t\t// @ts-ignore\n\t\tgreedyTable: true,\n\t})[0];\n\t*/\n\n\tstr = slugify(str, true);\n\n\treturn str;\n}\n\nexport default exports as typeof import('./index');\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-novel/normalize",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.30",
|
|
4
4
|
"description": "normalize file name for sort",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"@node-novel",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"sort",
|
|
12
12
|
"strip"
|
|
13
13
|
],
|
|
14
|
-
"homepage": "https://github.com/bluelovers/ws-node-novel/tree/master/packages/node-novel-
|
|
14
|
+
"homepage": "https://github.com/bluelovers/ws-node-novel/tree/master/packages/node-novel-normalize#readme",
|
|
15
15
|
"bugs": {
|
|
16
16
|
"url": "https://github.com/bluelovers/ws-node-novel/issues"
|
|
17
17
|
},
|
|
@@ -29,20 +29,21 @@
|
|
|
29
29
|
"test": "jest",
|
|
30
30
|
"npm:publish": "npm publish",
|
|
31
31
|
"npm:publish:lerna": "npx lerna publish --yes --cd-version patch",
|
|
32
|
+
"preversion": "yarn run test",
|
|
32
33
|
"prepublish:lockfile": "npx sync-lockfile .",
|
|
33
|
-
"prepublishOnly": "yarn run test",
|
|
34
34
|
"postpublish_": "git commit -m \"chore(release): publish\" .",
|
|
35
35
|
"ncu": "npx yarn-tool ncu -u",
|
|
36
36
|
"sort-package-json": "npx yarn-tool sort"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@lazy-cjk/novel-filename": "^1.0.
|
|
40
|
-
"@lazy-cjk/zh-slugify": "^1.0.
|
|
41
|
-
"normalize-num": "^1.0.
|
|
42
|
-
"str-util": "^2.3.
|
|
39
|
+
"@lazy-cjk/novel-filename": "^1.0.46",
|
|
40
|
+
"@lazy-cjk/zh-slugify": "^1.0.82",
|
|
41
|
+
"normalize-num": "^1.0.5",
|
|
42
|
+
"str-util": "^2.3.28",
|
|
43
|
+
"tslib": "^2"
|
|
43
44
|
},
|
|
44
45
|
"publishConfig": {
|
|
45
46
|
"access": "public"
|
|
46
47
|
},
|
|
47
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "aaa1c09413d3adf36c65d58a20450c4927f0d570"
|
|
48
49
|
}
|