@maioradv/nestjs-core 1.0.7 → 1.0.9

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.
@@ -3,3 +3,4 @@ export * from './path.helper';
3
3
  export * from './slug.helper';
4
4
  export * from './storage.helper';
5
5
  export * from './types.helper';
6
+ export * from './time.helper';
@@ -19,3 +19,4 @@ __exportStar(require("./path.helper"), exports);
19
19
  __exportStar(require("./slug.helper"), exports);
20
20
  __exportStar(require("./storage.helper"), exports);
21
21
  __exportStar(require("./types.helper"), exports);
22
+ __exportStar(require("./time.helper"), exports);
@@ -27,9 +27,10 @@ const fs = __importStar(require("fs"));
27
27
  const util_1 = require("util");
28
28
  const path_1 = require("path");
29
29
  const os_1 = require("os");
30
+ const path_helper_1 = require("./path.helper");
30
31
  class StorageHelper {
31
32
  constructor() {
32
- this.rootPath = (0, path_1.join)(__dirname, '..', '../../public');
33
+ this.rootPath = (0, path_helper_1.joinFromRoot)('public');
33
34
  }
34
35
  async read(path) {
35
36
  const realPath = (0, path_1.join)(this.rootPath, path);
@@ -0,0 +1 @@
1
+ export declare function toMs(str: string): number;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toMs = void 0;
4
+ function toMs(str) {
5
+ const matches = str.match(/(\d+)/);
6
+ const number = +matches[0] ?? 0;
7
+ const mode = str.replace(matches[0], '');
8
+ const unit = 1000;
9
+ const conversion = {
10
+ d: unit * 60 * 60 * 24,
11
+ h: unit * 60 * 60,
12
+ m: unit * 60,
13
+ s: unit,
14
+ };
15
+ return conversion[mode] * number ?? 0;
16
+ }
17
+ exports.toMs = toMs;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maioradv/nestjs-core",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "NestJS helpers by MaiorADV",
5
5
  "repository": "https://github.com/maioradv/nestjs-core.git",
6
6
  "author": "Maior ADV Srl",