Skip to content
Permalink
Browse files

assert: replace var with let in lib/assert.js

Refs: nodejs/code-and-learn#97

PR-URL: #30261
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
PerfectPan authored and MylesBorins committed Nov 5, 2019
1 parent d7c2911 commit ddbe9826d08eeb2c6918c630b7a68116101ad8ee
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/assert.js
@@ -185,7 +185,7 @@ function getCode(fd, line, column) {
buffer = lines < line ? buffer : Buffer.allocUnsafe(bytesPerRead);
bytesRead = readSync(fd, buffer, 0, bytesPerRead);
// Read the buffer until the required code line is found.
for (var i = 0; i < bytesRead; i++) {
for (let i = 0; i < bytesRead; i++) {
if (buffer[i] === 10 && ++lines === line) {
// If the end of file is reached, directly parse the code and return.
if (bytesRead < bytesPerRead) {
@@ -822,7 +822,7 @@ assert.ifError = function ifError(err) {
tmp2.shift();
// Filter all frames existing in err.stack.
let tmp1 = newErr.stack.split('\n');
for (var i = 0; i < tmp2.length; i++) {
for (let i = 0; i < tmp2.length; i++) {
// Find the first occurrence of the frame.
const pos = tmp1.indexOf(tmp2[i]);
if (pos !== -1) {

0 comments on commit ddbe982

Please sign in to comment.
You can’t perform that action at this time.