@punks/backend-core 0.0.76 → 0.0.77
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/dist/cjs/index.js +17 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/utils/encoding.d.ts +5 -0
- package/dist/cjs/types/utils/index.d.ts +1 -0
- package/dist/cjs/types/utils/uid.d.ts +1 -0
- package/dist/esm/index.js +13 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/utils/encoding.d.ts +5 -0
- package/dist/esm/types/utils/index.d.ts +1 -0
- package/dist/esm/types/utils/uid.d.ts +1 -0
- package/dist/index.d.ts +7 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -440,6 +440,11 @@ const jsonSerialize = (obj, options) => {
|
|
|
440
440
|
return JSON.stringify(obj, replacer, spaces);
|
|
441
441
|
};
|
|
442
442
|
|
|
443
|
+
const encodeUtf8 = (value) => Buffer.from(value).toString("utf-8");
|
|
444
|
+
const decodeUtf8 = (value) => Buffer.from(value, "utf-8");
|
|
445
|
+
const encodeBase64 = (value) => Buffer.from(value).toString("base64");
|
|
446
|
+
const decodeBase64 = (value) => Buffer.from(value, "base64");
|
|
447
|
+
|
|
443
448
|
const maskVariable = (value, unmaskedLength = 4) => value
|
|
444
449
|
? value.substring(0, unmaskedLength).concat(Array.from(value.substring(unmaskedLength))
|
|
445
450
|
.map(() => "*")
|
|
@@ -506,6 +511,13 @@ const newUuid = () => {
|
|
|
506
511
|
return v.toString(16);
|
|
507
512
|
});
|
|
508
513
|
};
|
|
514
|
+
const generateHash = (length) => {
|
|
515
|
+
let text = "";
|
|
516
|
+
const possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
517
|
+
for (let i = 0; i < length; i++)
|
|
518
|
+
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
|
519
|
+
return text;
|
|
520
|
+
};
|
|
509
521
|
|
|
510
522
|
function serializeQueryString(obj) {
|
|
511
523
|
let queryString = "";
|
|
@@ -31290,9 +31302,13 @@ exports.camelToSnakeCase = camelToSnakeCase;
|
|
|
31290
31302
|
exports.createDayPath = createDayPath;
|
|
31291
31303
|
exports.csvBuild = csvBuild;
|
|
31292
31304
|
exports.csvParse = csvParse;
|
|
31305
|
+
exports.decodeBase64 = decodeBase64;
|
|
31306
|
+
exports.decodeUtf8 = decodeUtf8;
|
|
31293
31307
|
exports.deserializeQueryString = deserializeQueryString;
|
|
31294
31308
|
exports.distinct = distinct;
|
|
31295
31309
|
exports.distinctElements = distinctElements;
|
|
31310
|
+
exports.encodeBase64 = encodeBase64;
|
|
31311
|
+
exports.encodeUtf8 = encodeUtf8;
|
|
31296
31312
|
exports.ensureDirectory = ensureDirectory;
|
|
31297
31313
|
exports.ensureStartSlash = ensureStartSlash;
|
|
31298
31314
|
exports.ensureTailingSlash = ensureTailingSlash;
|
|
@@ -31301,6 +31317,7 @@ exports.excelParse = excelParse;
|
|
|
31301
31317
|
exports.first = first;
|
|
31302
31318
|
exports.flatten = flatten;
|
|
31303
31319
|
exports.floorDateToSecond = floorDateToSecond;
|
|
31320
|
+
exports.generateHash = generateHash;
|
|
31304
31321
|
exports.getDirectoryFilePaths = getDirectoryFilePaths;
|
|
31305
31322
|
exports.getDirectoryPath = getDirectoryPath;
|
|
31306
31323
|
exports.getQueryParameter = getQueryParameter;
|