@chevrotain/utils 10.1.2 → 10.2.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/lib/src/print.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.PRINT_WARNING = exports.PRINT_ERROR = void 0;
|
|
|
4
4
|
function PRINT_ERROR(msg) {
|
|
5
5
|
/* istanbul ignore else - can't override global.console in node.js */
|
|
6
6
|
if (console && console.error) {
|
|
7
|
-
console.error(
|
|
7
|
+
console.error(`Error: ${msg}`);
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
exports.PRINT_ERROR = PRINT_ERROR;
|
|
@@ -12,7 +12,7 @@ function PRINT_WARNING(msg) {
|
|
|
12
12
|
/* istanbul ignore else - can't override global.console in node.js*/
|
|
13
13
|
if (console && console.warn) {
|
|
14
14
|
// TODO: modify docs accordingly
|
|
15
|
-
console.warn(
|
|
15
|
+
console.warn(`Warning: ${msg}`);
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
exports.PRINT_WARNING = PRINT_WARNING;
|
package/lib/src/print.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"print.js","sourceRoot":"","sources":["../../src/print.ts"],"names":[],"mappings":";;;AAAA,SAAgB,WAAW,CAAC,GAAW;IACrC,qEAAqE;IACrE,IAAI,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE;QAC5B,OAAO,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"print.js","sourceRoot":"","sources":["../../src/print.ts"],"names":[],"mappings":";;;AAAA,SAAgB,WAAW,CAAC,GAAW;IACrC,qEAAqE;IACrE,IAAI,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE;QAC5B,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,EAAE,CAAC,CAAA;KAC/B;AACH,CAAC;AALD,kCAKC;AAED,SAAgB,aAAa,CAAC,GAAW;IACvC,oEAAoE;IACpE,IAAI,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE;QAC3B,gCAAgC;QAChC,OAAO,CAAC,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC,CAAA;KAChC;AACH,CAAC;AAND,sCAMC"}
|
package/lib/src/timer.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.timer = void 0;
|
|
4
4
|
function timer(func) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
const start = new Date().getTime();
|
|
6
|
+
const val = func();
|
|
7
|
+
const end = new Date().getTime();
|
|
8
|
+
const total = end - start;
|
|
9
9
|
return { time: total, value: val };
|
|
10
10
|
}
|
|
11
11
|
exports.timer = timer;
|
package/lib/src/timer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timer.js","sourceRoot":"","sources":["../../src/timer.ts"],"names":[],"mappings":";;;AAAA,SAAgB,KAAK,CAAI,IAAa;IACpC,
|
|
1
|
+
{"version":3,"file":"timer.js","sourceRoot":"","sources":["../../src/timer.ts"],"names":[],"mappings":";;;AAAA,SAAgB,KAAK,CAAI,IAAa;IACpC,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAA;IAClC,MAAM,GAAG,GAAG,IAAI,EAAE,CAAA;IAClB,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAA;IAChC,MAAM,KAAK,GAAG,GAAG,GAAG,KAAK,CAAA;IACzB,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,CAAA;AACpC,CAAC;AAND,sBAMC"}
|
|
@@ -6,7 +6,7 @@ function toFastProperties(toBecomeFast) {
|
|
|
6
6
|
function FakeConstructor() { }
|
|
7
7
|
// If our object is used as a constructor it would receive
|
|
8
8
|
FakeConstructor.prototype = toBecomeFast;
|
|
9
|
-
|
|
9
|
+
const fakeInstance = new FakeConstructor();
|
|
10
10
|
function fakeAccess() {
|
|
11
11
|
return typeof fakeInstance.bar;
|
|
12
12
|
}
|
|
@@ -14,7 +14,10 @@ function toFastProperties(toBecomeFast) {
|
|
|
14
14
|
// the fake instance.
|
|
15
15
|
fakeAccess();
|
|
16
16
|
fakeAccess();
|
|
17
|
-
|
|
17
|
+
// Always true condition to suppress the Firefox warning of unreachable
|
|
18
|
+
// code after a return statement.
|
|
19
|
+
if (1)
|
|
20
|
+
return toBecomeFast;
|
|
18
21
|
// Eval prevents optimization of this method (even though this is dead code)
|
|
19
22
|
/* istanbul ignore next */
|
|
20
23
|
// tslint:disable-next-line
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-fast-properties.js","sourceRoot":"","sources":["../../src/to-fast-properties.ts"],"names":[],"mappings":";;;AAAA,yHAAyH;AACzH,SAAgB,gBAAgB,CAAC,YAAiB;IAChD,SAAS,eAAe,KAAI,CAAC;IAE7B,0DAA0D;IAC1D,eAAe,CAAC,SAAS,GAAG,YAAY,CAAA;IACxC,
|
|
1
|
+
{"version":3,"file":"to-fast-properties.js","sourceRoot":"","sources":["../../src/to-fast-properties.ts"],"names":[],"mappings":";;;AAAA,yHAAyH;AACzH,SAAgB,gBAAgB,CAAC,YAAiB;IAChD,SAAS,eAAe,KAAI,CAAC;IAE7B,0DAA0D;IAC1D,eAAe,CAAC,SAAS,GAAG,YAAY,CAAA;IACxC,MAAM,YAAY,GAAG,IAAK,eAAuB,EAAE,CAAA;IAEnD,SAAS,UAAU;QACjB,OAAO,OAAO,YAAY,CAAC,GAAG,CAAA;IAChC,CAAC;IAED,kEAAkE;IAClE,qBAAqB;IACrB,UAAU,EAAE,CAAA;IACZ,UAAU,EAAE,CAAA;IAEZ,uEAAuE;IACvE,iCAAiC;IACjC,IAAI,CAAC;QAAE,OAAO,YAAY,CAAA;IAE1B,4EAA4E;IAC5E,0BAA0B;IAC1B,2BAA2B;IAC3B,IAAI,CAAC,YAAY,CAAC,CAAA;AACpB,CAAC;AAxBD,4CAwBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chevrotain/utils",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.2.0",
|
|
4
4
|
"description": "common utilities",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"bugs": {
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"---------- CI FLOWS --------": "",
|
|
29
|
+
"ci": "npm-run-all build test",
|
|
29
30
|
"build": "npm-run-all clean compile",
|
|
30
31
|
"test": "npm-run-all coverage",
|
|
31
32
|
"---------- BUILD STEPS --------": "",
|
|
@@ -37,5 +38,5 @@
|
|
|
37
38
|
"publishConfig": {
|
|
38
39
|
"access": "public"
|
|
39
40
|
},
|
|
40
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "f9c92d8ec45c9236abb53091380682d4b32f8207"
|
|
41
42
|
}
|
|
@@ -15,7 +15,10 @@ export function toFastProperties(toBecomeFast: any) {
|
|
|
15
15
|
fakeAccess()
|
|
16
16
|
fakeAccess()
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
// Always true condition to suppress the Firefox warning of unreachable
|
|
19
|
+
// code after a return statement.
|
|
20
|
+
if (1) return toBecomeFast
|
|
21
|
+
|
|
19
22
|
// Eval prevents optimization of this method (even though this is dead code)
|
|
20
23
|
/* istanbul ignore next */
|
|
21
24
|
// tslint:disable-next-line
|