Skip to content

Commit

Permalink
refactor: replace deprecated String.prototype.substr()
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 Mar 23, 2022
1 parent 2077b6a commit 84fa7cb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/graphql-playground-react/config/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const envPublicUrl = process.env.PUBLIC_URL
function ensureSlash(path, needsSlash) {
const hasSlash = path.endsWith('/')
if (hasSlash && !needsSlash) {
return path.substr(path, path.length - 1)
return path.slice(0, -1)
} else if (!hasSlash && needsSlash) {
return `${path}/`
} else {
Expand Down

0 comments on commit 84fa7cb

Please sign in to comment.