utilitas 1989.9.8 → 1989.9.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.
package/lib/event.mjs CHANGED
@@ -1,9 +1,11 @@
1
- import { fileURLToPath } from 'url';
2
1
  import { v4 as uuidv4 } from 'uuid';
3
2
  import * as utilitas from './utilitas.mjs';
4
3
  import fs from 'fs';
5
4
  import path from 'path';
6
5
 
6
+ const fileURLToPath = (await import('url')).fileURLToPath
7
+ || ((url) => { return new URL('', url).pathname; });
8
+
7
9
  const __filename = fileURLToPath(import.meta.url);
8
10
  const jobs = {};
9
11
  const sToMs = (sec) => { return 1000 * (isNaN(sec = Number(sec)) ? 0 : sec); };
package/lib/uoid.mjs CHANGED
@@ -1,8 +1,10 @@
1
- import { fileURLToPath } from 'url';
2
1
  import * as encryption from './encryption.mjs';
3
2
  import * as utilitas from './utilitas.mjs';
4
3
  import * as uuid from 'uuid';
5
4
 
5
+ const fileURLToPath = (await import('url')).fileURLToPath
6
+ || ((url) => { return new URL('', url).pathname; });
7
+
6
8
  const __filename = fileURLToPath(import.meta.url);
7
9
  const uuidRegTxt = '[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}';
8
10
 
package/lib/utilitas.mjs CHANGED
@@ -1,4 +1,3 @@
1
- import { fileURLToPath } from 'url';
2
1
  import * as storage from './storage.mjs';
3
2
  import colors from 'colors/safe.js';
4
3
  import path from 'path';
@@ -13,6 +12,9 @@ RegExp.escape = RegExp.escape || ((str) => { //$& means the whole matched string
13
12
  return String(str).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
14
13
  }); // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
15
14
 
15
+ const fileURLToPath = (await import('url')).fileURLToPath
16
+ || ((url) => { return new URL('', url).pathname; });
17
+
16
18
  const __filename = fileURLToPath(import.meta.url);
17
19
  const invalidTime = 'Invalid time.';
18
20
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "utilitas",
3
3
  "description": "Just another common utility for Node.js.",
4
- "version": "1989.9.8",
4
+ "version": "1989.9.9",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/utilitas",
7
7
  "main": "index.mjs",