larvitutils 4.0.1 → 5.0.1

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/README.md CHANGED
@@ -1,6 +1,5 @@
1
1
  [![Build Status](https://travis-ci.org/larvit/larvitutils.svg)](https://travis-ci.org/larvit/larvitutils)
2
2
  [![Dependencies](https://david-dm.org/larvit/larvitutils.svg)](https://david-dm.org/larvit/larvitutils.svg)
3
- [![Coverage Status](https://coveralls.io/repos/github/larvit/larvitutils/badge.svg)](https://coveralls.io/github/larvit/larvitutils)
4
3
 
5
4
  # larvitutils
6
5
 
@@ -34,6 +33,10 @@ const utils = new Utils({ log });
34
33
 
35
34
  Very summarized, see specific commits for more details
36
35
 
36
+ v5.0.0 - Updated dependency versions and fixed some TypeScript errors. Removed coveralls since it's dependent on deprecated packages.
37
+
38
+ v4.0.2 - Even stricter control of process not being set for some environments
39
+
37
40
  v4.0.1 - Fixed bug where process.env.NODE_LOG_LVL was expected to be set in browsers if no log level was provided on instansiation
38
41
 
39
42
  v4.0.0 - ECMA Module distribution, dropped support for CommonJS
package/dist/index.d.ts CHANGED
@@ -55,7 +55,7 @@ declare class Utils {
55
55
  * @return {string} The result
56
56
  */
57
57
  replaceAll(search: string, replace: string, str: string): string;
58
- setTimeout(ms: number): Promise<unknown>;
58
+ setTimeout(ms: number): Promise<void>;
59
59
  /**
60
60
  * Make a buffer from an uuid string
61
61
  *
package/dist/index.js CHANGED
@@ -1,3 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Log = exports.Utils = void 0;
1
4
  const topLogPrefix = 'larvitutils: src/index.ts: ';
2
5
  class Log {
3
6
  /**
@@ -63,7 +66,7 @@ class Log {
63
66
  }
64
67
  }
65
68
  getDefaultLogLevel() {
66
- if (!process || !process.env || !process.env.NODE_LOG_LVL) {
69
+ if (typeof process === 'undefined' || !process || !process.env || !process.env.NODE_LOG_LVL) {
67
70
  return 'info';
68
71
  }
69
72
  else if (this.validLogLevels.includes(process.env.NODE_LOG_LVL || '')) {
@@ -93,6 +96,7 @@ class Log {
93
96
  return false;
94
97
  }
95
98
  }
99
+ exports.Log = Log;
96
100
  class Utils {
97
101
  constructor(options) {
98
102
  this.Log = Log;
@@ -101,7 +105,7 @@ class Utils {
101
105
  this.log = this.options.log;
102
106
  }
103
107
  else {
104
- this.log = this.options.log = new this.Log();
108
+ this.log = this.options.log = new Log();
105
109
  }
106
110
  }
107
111
  getUniqueCombinations(keyValues) {
@@ -152,7 +156,7 @@ class Utils {
152
156
  return ((diff[0] * 1000) + (diff[1] / 1000000)).toFixed(precision);
153
157
  }
154
158
  escapeRegExp(str) {
155
- return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1');
159
+ return str.replace(/([.*+?^=!:${}()|[\]/\\])/g, '\\$1');
156
160
  }
157
161
  /**
158
162
  * Formats an uuid string
@@ -239,7 +243,6 @@ class Utils {
239
243
  if (isNaN(value)) {
240
244
  return false;
241
245
  }
242
- // tslint:disable-next-line:no-bitwise
243
246
  return (x | 0) === x;
244
247
  }
245
248
  isLogInstance(logInstance) {
@@ -256,4 +259,4 @@ class Utils {
256
259
  return false;
257
260
  }
258
261
  }
259
- export { Utils, Log };
262
+ exports.Utils = Utils;
package/package.json CHANGED
@@ -1,27 +1,26 @@
1
1
  {
2
2
  "name": "larvitutils",
3
- "version": "4.0.1",
3
+ "version": "5.0.1",
4
4
  "description": "Misc utils",
5
- "type": "module",
6
5
  "main": "./dist/index.js",
7
6
  "files": [
8
7
  "/dist"
9
8
  ],
10
9
  "devDependencies": {
11
- "@types/node": "12.12.14",
12
- "@types/tape": "4.2.33",
13
- "coveralls": "3.0.8",
14
- "nyc": "14.1.1",
15
- "tap-spec": "5.0.0",
16
- "tape": "4.11.0",
17
- "ts-node": "8.5.2",
18
- "tslint": "5.20.1",
19
- "typescript": "3.7.2"
10
+ "@types/node": "16.11.26",
11
+ "@types/tape": "4.13.2",
12
+ "@typescript-eslint/eslint-plugin": "5.16.0",
13
+ "@typescript-eslint/parser": "5.16.0",
14
+ "eslint": "8.11.0",
15
+ "nyc": "15.1.0",
16
+ "tape": "5.5.2",
17
+ "ts-node": "10.7.0",
18
+ "typescript": "4.6.2"
20
19
  },
21
20
  "scripts": {
22
- "build": "rm -rf ./dist/* && tsc -p ./tsconfig.dist.json && cp ./src/models.d.ts ./dist/",
23
- "lint": "tslint ./src/* ./test/**/*.ts",
24
- "test": "npm run lint && npm run build && nyc --reporter=lcov --require ts-node/register tape test/**/*.ts | tap-spec; nyc report ---reporter=text"
21
+ "build": "rm -rf ./dist/* && tsc && cp ./src/models.d.ts ./dist/",
22
+ "lint": "eslint ./src/* ./test/**/*.ts",
23
+ "test": "npm run lint && npm run build && ./node_modules/.bin/nyc ts-node -P ./tsconfig.json ./node_modules/tape/bin/tape test/**/*.ts"
25
24
  },
26
25
  "repository": {
27
26
  "type": "git",