@konplit-services/common 1.0.36 → 1.0.37
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.
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param alphabet Set of random strings to be used to generate IDs
|
|
3
|
+
* @param numberOfCharacters The number of characters to be returned
|
|
4
|
+
*
|
|
5
|
+
* This function takes in the number of characters to be returned.
|
|
6
|
+
* If the numberOfCharacters input is not provided, the default of 15 is returned.
|
|
7
|
+
*/
|
|
8
|
+
export declare const uniqueId: (alphabet?: string, numberOfCharacters?: number) => string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.uniqueId = void 0;
|
|
4
|
+
const nanoid_1 = require("nanoid");
|
|
5
|
+
/**
|
|
6
|
+
* @param alphabet Set of random strings to be used to generate IDs
|
|
7
|
+
* @param numberOfCharacters The number of characters to be returned
|
|
8
|
+
*
|
|
9
|
+
* This function takes in the number of characters to be returned.
|
|
10
|
+
* If the numberOfCharacters input is not provided, the default of 15 is returned.
|
|
11
|
+
*/
|
|
12
|
+
const uniqueId = (alphabet = "0123456789", numberOfCharacters = 13) => {
|
|
13
|
+
const nanoid = (0, nanoid_1.customAlphabet)(alphabet, numberOfCharacters);
|
|
14
|
+
return `vp${nanoid()}`;
|
|
15
|
+
};
|
|
16
|
+
exports.uniqueId = uniqueId;
|
package/build/util/index.d.ts
CHANGED
package/build/util/index.js
CHANGED
|
@@ -17,5 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./lib/nats/nat-error-codes"), exports);
|
|
18
18
|
__exportStar(require("./jwt.validation"), exports);
|
|
19
19
|
__exportStar(require("./parse-query-string"), exports);
|
|
20
|
-
__exportStar(require("./id"), exports);
|
|
20
|
+
__exportStar(require("./generate-id"), exports);
|
|
21
21
|
__exportStar(require("./format-phoneNumber"), exports);
|