Skip to content

Commit

Permalink
Merge pull request #71 from CommanderRoot/refactor/rm-deprecated-substr
Browse files Browse the repository at this point in the history
refactor: replace deprecated String.prototype.substr()
  • Loading branch information
goto-bus-stop authored May 18, 2022
2 parents ad9dbe0 + 073daed commit a292d8a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions util.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
if (array) {
str = str.split('\n').map(function(line) {
return ' ' + line;
}).join('\n').substr(2);
}).join('\n').slice(2);
} else {
str = '\n' + str.split('\n').map(function(line) {
return ' ' + line;
Expand All @@ -427,7 +427,7 @@ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
}
name = JSON.stringify('' + key);
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
name = name.substr(1, name.length - 2);
name = name.slice(1, -1);
name = ctx.stylize(name, 'name');
} else {
name = name.replace(/'/g, "\\'")
Expand Down

0 comments on commit a292d8a

Please sign in to comment.