From 17d95ea1f0be2204cc040b8b0a9d1144f28baaab Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Mon, 7 May 2018 03:53:02 +0200 Subject: assert,util: lazy load comparison functions PR-URL: https://github.com/nodejs/node/pull/20567 Reviewed-By: Gus Caplan Reviewed-By: Matteo Collina Reviewed-By: James M Snell Reviewed-By: Jeremiah Senkpiel --- lib/util.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'lib/util.js') diff --git a/lib/util.js b/lib/util.js index 45d98de194..bd7a98694b 100644 --- a/lib/util.js +++ b/lib/util.js @@ -64,10 +64,6 @@ const { isTypedArray } = types; -const { - isDeepStrictEqual -} = require('internal/util/comparisons'); - const { customInspectSymbol, deprecate, @@ -95,6 +91,7 @@ const dateToISOString = Date.prototype.toISOString; const errorToString = Error.prototype.toString; let CIRCULAR_ERROR_MESSAGE; +let internalDeepEqual; /* eslint-disable */ const strEscapeSequencesRegExp = /[\x00-\x1f\x27\x5c]/; @@ -1261,7 +1258,13 @@ module.exports = exports = { isArray: Array.isArray, isBoolean, isBuffer, - isDeepStrictEqual, + isDeepStrictEqual(a, b) { + if (internalDeepEqual === undefined) { + internalDeepEqual = require('internal/util/comparisons') + .isDeepStrictEqual; + } + return internalDeepEqual(a, b); + }, isNull, isNullOrUndefined, isNumber, -- cgit v1.2.3