lib: refactor to use primordials in lib/assert.js

PR-URL: https://github.com/nodejs/node/pull/41702
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
This commit is contained in:
akhil marsonya 2022-03-15 05:47:12 +05:30 committed by GitHub
parent 4d072fecd2
commit 6f8c983f90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -965,10 +965,10 @@ assert.ifError = function ifError(err) {
// This will remove any duplicated frames from the error frames taken
// from within `ifError` and add the original error frames to the newly
// created ones.
const origStackStart = origStack.indexOf('\n at');
const origStackStart = StringPrototypeIndexOf(origStack, '\n at');
if (origStackStart !== -1) {
const originalFrames = StringPrototypeSplit(
origStack.slice(origStackStart + 1),
StringPrototypeSlice(origStack, origStackStart + 1),
'\n'
);
// Filter all frames existing in err.stack.