aboutsummaryrefslogtreecommitdiff
path: root/lib/internal/assert/assertion_error.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/internal/assert/assertion_error.js')
-rw-r--r--lib/internal/assert/assertion_error.js18
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/internal/assert/assertion_error.js b/lib/internal/assert/assertion_error.js
index 0b57bf2cb2..69a6d8afac 100644
--- a/lib/internal/assert/assertion_error.js
+++ b/lib/internal/assert/assertion_error.js
@@ -1,6 +1,12 @@
'use strict';
-const { Math, Object } = primordials;
+const {
+ MathMax,
+ ObjectCreate,
+ ObjectDefineProperty,
+ ObjectGetPrototypeOf,
+ ObjectKeys,
+} = primordials;
const { inspect } = require('internal/util/inspect');
const { codes: {
@@ -31,12 +37,12 @@ const kReadableOperator = {
const kMaxShortLength = 12;
function copyError(source) {
- const keys = Object.keys(source);
- const target = Object.create(Object.getPrototypeOf(source));
+ const keys = ObjectKeys(source);
+ const target = ObjectCreate(ObjectGetPrototypeOf(source));
for (const key of keys) {
target[key] = source[key];
}
- Object.defineProperty(target, 'message', { value: source.message });
+ ObjectDefineProperty(target, 'message', { value: source.message });
return target;
}
@@ -135,7 +141,7 @@ function createErrDiff(actual, expected, operator) {
b = expectedLines[expectedLines.length - 1];
}
- const maxLines = Math.max(actualLines.length, expectedLines.length);
+ const maxLines = MathMax(actualLines.length, expectedLines.length);
// Strict equal with identical objects that are not identical by reference.
// E.g., assert.deepStrictEqual({ a: Symbol() }, { a: Symbol() })
if (maxLines === 0) {
@@ -404,7 +410,7 @@ class AssertionError extends Error {
Error.stackTraceLimit = limit;
this.generatedMessage = !message;
- Object.defineProperty(this, 'name', {
+ ObjectDefineProperty(this, 'name', {
value: 'AssertionError [ERR_ASSERTION]',
enumerable: false,
writable: true,