sm-utility 2.2.14 → 2.2.15
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/general/index.d.ts +1 -0
- package/general/index.js +8 -1
- package/package.json +2 -1
package/general/index.d.ts
CHANGED
|
@@ -2,3 +2,4 @@ export declare function pipe(...fns: Array<Function>): any;
|
|
|
2
2
|
export declare function randomSixDigitNumber(): number;
|
|
3
3
|
export declare function timeout(ms: number): Promise<any>;
|
|
4
4
|
export declare function mergeDeep(target: Record<string, any>, source: Record<string, any>): Record<string, any>;
|
|
5
|
+
export declare function shortUniqueId(): string;
|
package/general/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mergeDeep = exports.timeout = exports.randomSixDigitNumber = exports.pipe = void 0;
|
|
3
|
+
exports.shortUniqueId = exports.mergeDeep = exports.timeout = exports.randomSixDigitNumber = exports.pipe = void 0;
|
|
4
|
+
const nanoid_1 = require("nanoid");
|
|
4
5
|
function pipe(...fns) {
|
|
5
6
|
return (x) => fns.reduce((v, f) => f(v), x);
|
|
6
7
|
}
|
|
@@ -36,3 +37,9 @@ function mergeDeep(target, source) {
|
|
|
36
37
|
return target;
|
|
37
38
|
}
|
|
38
39
|
exports.mergeDeep = mergeDeep;
|
|
40
|
+
function shortUniqueId() {
|
|
41
|
+
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
42
|
+
const nanoid = nanoid_1.customAlphabet(alphabet, 8);
|
|
43
|
+
return nanoid();
|
|
44
|
+
}
|
|
45
|
+
exports.shortUniqueId = shortUniqueId;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sm-utility",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.15",
|
|
4
4
|
"description": "reusable utility codes for sm projects",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"aws-sdk": "^2.1134.0",
|
|
31
31
|
"axios": "^0.23.0",
|
|
32
32
|
"express-winston": "^4.1.0",
|
|
33
|
+
"nanoid": "^3.3.6",
|
|
33
34
|
"node-xlsx": "^0.23.0",
|
|
34
35
|
"redis": "^4.1.0",
|
|
35
36
|
"ts-node": "^10.9.1",
|