crabatool 1.0.508 → 1.0.509
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/lib/jsoncrud.js +4 -4
- package/package.json +2 -1
package/lib/jsoncrud.js
CHANGED
|
@@ -67,11 +67,11 @@ class JSONCRUD {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
async batchCreate(entityName, items) {
|
|
70
|
+
async batchCreate(entityName, items) {
|
|
71
71
|
await this.ready()
|
|
72
72
|
this.verifyEntityExists(entityName)
|
|
73
73
|
var _this = this;
|
|
74
|
-
items.forEach(item=>{
|
|
74
|
+
items.forEach(item => {
|
|
75
75
|
const newItem = {
|
|
76
76
|
id: cuid.newCuidString(),//允许外部提前制定ID
|
|
77
77
|
...item,
|
|
@@ -119,7 +119,7 @@ class JSONCRUD {
|
|
|
119
119
|
} else if (typeof v1 == 'number') {
|
|
120
120
|
return sortOrder === 'acs' ? v1 > v2 : v1 < v2;
|
|
121
121
|
} else {
|
|
122
|
-
return sortOrder === 'asc' ? v1
|
|
122
|
+
return sortOrder === 'asc' ? v1.localeCompare(v2) : v2.localeCompare(v1);
|
|
123
123
|
}
|
|
124
124
|
});
|
|
125
125
|
|
|
@@ -239,7 +239,7 @@ class JSONCRUD {
|
|
|
239
239
|
if (stats.isFile()) {
|
|
240
240
|
var entityName = file.substring(0, file.lastIndexOf('.'));
|
|
241
241
|
var temp = await fs.readFile(filePath, 'utf-8')
|
|
242
|
-
fileContent[entityName] = temp?JSON.parse(temp):{};
|
|
242
|
+
fileContent[entityName] = temp ? JSON.parse(temp) : {};
|
|
243
243
|
} else if (stats.isDirectory()) {
|
|
244
244
|
// 如果需要递归处理子目录,可以在这里调用readAllFilesInDirectory(filePath)
|
|
245
245
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "crabatool",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.509",
|
|
4
4
|
"description": "crabatool",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"javadocFile": "node ./test/test.js -convertJavadoc -filePath F:/docs/shell/com/wsgjp/ct/shell/biz/entity/Etype.html -outPath F:/docs/md",
|
|
11
11
|
"shell-doc": "node ./test/test.js -convertJavadoc -targetPath F:/docs/shell -outPath F:/docs/shell.json",
|
|
12
12
|
"jxc-doc": "node ./test/test.js -convertJavadoc -targetPath F:/docs/jxc -outPath F:/docs/jxc.json",
|
|
13
|
+
"sale-doc": "node ./test/test.js -convertJavadoc -targetPath F:/docs/sale -outPath F:/docs/sale.json",
|
|
13
14
|
"start": "node run.js",
|
|
14
15
|
"test": "node ./test/test.js",
|
|
15
16
|
"run": "node ./test/test.js -run -webPath F:/basicweb/www -refresh true",
|