Skip to content

Commit

Permalink
refactor: replace deprecated String.prototype.substr() (#950)
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 authored Mar 28, 2022
1 parent 69eb896 commit e0d298d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/copy/__tests__/ncp/ncp.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('ncp', () => {

describe('when copying files using filter', () => {
before(cb => {
const filter = name => name.substr(name.length - 1) !== 'a'
const filter = name => name.slice(-1) !== 'a'

rimraf(out, () => ncp(src, out, { filter }, cb))
})
Expand All @@ -45,7 +45,7 @@ describe('ncp', () => {
const curFile = files[fileName]
if (curFile instanceof Object) {
filter(curFile)
} else if (fileName.substr(fileName.length - 1) === 'a') {
} else if (fileName.slice(-1) === 'a') {
delete files[fileName]
}
}
Expand Down

0 comments on commit e0d298d

Please sign in to comment.