larvitutils 4.0.0-beta4 → 5.0.0

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,12 @@ 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
+
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
41
+
37
42
  v4.0.0 - ECMA Module distribution, dropped support for CommonJS
38
43
 
39
44
  v3.2.0 - Added getUniqueCombinations()
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,10 @@ class Log {
63
66
  }
64
67
  }
65
68
  getDefaultLogLevel() {
66
- if (this.validLogLevels.includes(process.env.NODE_LOG_LVL || '')) {
69
+ if (typeof process === 'undefined' || !process || !process.env || !process.env.NODE_LOG_LVL) {
70
+ return 'info';
71
+ }
72
+ else if (this.validLogLevels.includes(process.env.NODE_LOG_LVL || '')) {
67
73
  return process.env.NODE_LOG_LVL;
68
74
  }
69
75
  else {
@@ -90,6 +96,7 @@ class Log {
90
96
  return false;
91
97
  }
92
98
  }
99
+ exports.Log = Log;
93
100
  class Utils {
94
101
  constructor(options) {
95
102
  this.Log = Log;
@@ -98,7 +105,7 @@ class Utils {
98
105
  this.log = this.options.log;
99
106
  }
100
107
  else {
101
- this.log = this.options.log = new this.Log();
108
+ this.log = this.options.log = new Log();
102
109
  }
103
110
  }
104
111
  getUniqueCombinations(keyValues) {
@@ -149,7 +156,7 @@ class Utils {
149
156
  return ((diff[0] * 1000) + (diff[1] / 1000000)).toFixed(precision);
150
157
  }
151
158
  escapeRegExp(str) {
152
- return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1');
159
+ return str.replace(/([.*+?^=!:${}()|[\]/\\])/g, '\\$1');
153
160
  }
154
161
  /**
155
162
  * Formats an uuid string
@@ -236,7 +243,6 @@ class Utils {
236
243
  if (isNaN(value)) {
237
244
  return false;
238
245
  }
239
- // tslint:disable-next-line:no-bitwise
240
246
  return (x | 0) === x;
241
247
  }
242
248
  isLogInstance(logInstance) {
@@ -253,4 +259,4 @@ class Utils {
253
259
  return false;
254
260
  }
255
261
  }
256
- 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.0-beta4",
3
+ "version": "5.0.0",
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.9",
12
- "@types/tape": "4.2.33",
13
- "coveralls": "3.0.7",
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.9",
11
+ "@types/tape": "4.13.2",
12
+ "@typescript-eslint/eslint-plugin": "5.4.0",
13
+ "@typescript-eslint/parser": "5.4.0",
14
+ "eslint": "8.3.0",
15
+ "nyc": "15.1.0",
16
+ "tape": "5.3.2",
17
+ "ts-node": "10.4.0",
18
+ "typescript": "4.5.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",