Skip to content

Commit

Permalink
fix: replace deprecated String.prototype.substr() (#155)
Browse files Browse the repository at this point in the history
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
  • Loading branch information
CommanderRoot committed Apr 5, 2022
1 parent 837831a commit e3a5d18
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/ini.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,8 @@ const unsafe = (val, doUnesc) => {
if (isQuoted(val)) {
// remove the single quotes before calling JSON.parse
if (val.charAt(0) === "'") {
val = val.substr(1, val.length - 2)
val = val.slice(1, -1)
}

try {
val = JSON.parse(val)
} catch (_) {}
Expand Down

0 comments on commit e3a5d18

Please sign in to comment.