qsu 1.0.7 → 1.0.8
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/.eslintrc.cjs +1 -1
- package/dist/index.js +14 -1
- package/package.json +6 -6
package/.eslintrc.cjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { basename, extname } from 'path';
|
|
1
|
+
import { basename, extname, win32 } from 'path';
|
|
2
2
|
import { randomBytes, createCipheriv, createDecipheriv, createHash, } from 'crypto';
|
|
3
3
|
export default class Qsu {
|
|
4
4
|
/*
|
|
@@ -177,6 +177,9 @@ export default class Qsu {
|
|
|
177
177
|
}
|
|
178
178
|
static truncate(str, length, ellipsis = '') {
|
|
179
179
|
let convStr = str;
|
|
180
|
+
if (!str) {
|
|
181
|
+
return '';
|
|
182
|
+
}
|
|
180
183
|
if (str.length > length) {
|
|
181
184
|
convStr = str.substring(0, length) + ellipsis;
|
|
182
185
|
}
|
|
@@ -361,6 +364,16 @@ export default class Qsu {
|
|
|
361
364
|
return new Intl.NumberFormat().format(number);
|
|
362
365
|
}
|
|
363
366
|
static fileName(filePath, withExtension = false) {
|
|
367
|
+
if (!filePath) {
|
|
368
|
+
return '';
|
|
369
|
+
}
|
|
370
|
+
if (filePath.indexOf('/') === -1) {
|
|
371
|
+
// Windows path
|
|
372
|
+
if (withExtension) {
|
|
373
|
+
return win32.basename(filePath);
|
|
374
|
+
}
|
|
375
|
+
return win32.basename(filePath, extname(filePath));
|
|
376
|
+
}
|
|
364
377
|
if (withExtension) {
|
|
365
378
|
return basename(filePath);
|
|
366
379
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qsu",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Quick and Simple Utility for JavaScript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc",
|
|
9
|
-
"test": "npm run
|
|
9
|
+
"test": "npm run build && mocha --parallel test/*.spec.js",
|
|
10
10
|
"lint": "eslint .",
|
|
11
11
|
"lint:fix": "eslint --fix ."
|
|
12
12
|
},
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"math"
|
|
44
44
|
],
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@types/node": "^18.
|
|
47
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
48
|
-
"@typescript-eslint/parser": "^5.
|
|
46
|
+
"@types/node": "^18.7.3",
|
|
47
|
+
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
|
48
|
+
"@typescript-eslint/parser": "^5.33.0",
|
|
49
49
|
"date-fns": "^2.29.1",
|
|
50
|
-
"eslint": "^8.
|
|
50
|
+
"eslint": "^8.22.0",
|
|
51
51
|
"eslint-config-airbnb": "^19.0.4",
|
|
52
52
|
"eslint-plugin-import": "^2.26.0",
|
|
53
53
|
"mocha": "^10.0.0",
|