@hastehaul/common 1.0.22 → 1.0.25
Sign up to get free protection for your applications and to get access to all the features.
- package/build/index.d.ts +1 -0
- package/build/index.js +1 -0
- package/build/utils/utils.d.ts +3 -0
- package/build/utils/utils.js +22 -0
- package/package.json +2 -1
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
@@ -115,6 +115,7 @@ __exportStar(require("./utils/read-dir"), exports);
|
|
115
115
|
__exportStar(require("./utils/schemas"), exports);
|
116
116
|
//TODO: DOCUMENT
|
117
117
|
__exportStar(require("./utils/random-codes"), exports);
|
118
|
+
__exportStar(require("./utils/utils"), exports);
|
118
119
|
/**
|
119
120
|
*? Re-exports all the contents from the "base-producers" module.
|
120
121
|
*
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.formatDatetimeToHumanReadable = exports.colorize = exports.hasElapsed = void 0;
|
7
|
+
const moment_1 = __importDefault(require("moment"));
|
8
|
+
function hasElapsed(expirationDate) {
|
9
|
+
const currentDate = (0, moment_1.default)();
|
10
|
+
const targetDate = (0, moment_1.default)(expirationDate);
|
11
|
+
return targetDate.isBefore(currentDate);
|
12
|
+
}
|
13
|
+
exports.hasElapsed = hasElapsed;
|
14
|
+
// Function to add color to console logs
|
15
|
+
function colorize(text, colorCode) {
|
16
|
+
return `\x1b[${colorCode}m${text}\x1b[0m`;
|
17
|
+
}
|
18
|
+
exports.colorize = colorize;
|
19
|
+
function formatDatetimeToHumanReadable(datetime, format) {
|
20
|
+
return (0, moment_1.default)(datetime).format(format || 'MMMM D, YYYY h:mm A');
|
21
|
+
}
|
22
|
+
exports.formatDatetimeToHumanReadable = formatDatetimeToHumanReadable;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@hastehaul/common",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.25",
|
4
4
|
"description": "",
|
5
5
|
"main": "./build/index.js",
|
6
6
|
"types": "./build/index.d.ts",
|
@@ -28,6 +28,7 @@
|
|
28
28
|
"express": "^4.18.2",
|
29
29
|
"ioredis": "^5.3.2",
|
30
30
|
"jsonwebtoken": "^9.0.1",
|
31
|
+
"moment": "^2.29.4",
|
31
32
|
"nats": "^2.15.1",
|
32
33
|
"socket.io": "^4.7.1"
|
33
34
|
}
|