Skip to content

refactor: replace deprecated String.prototype.substr() - #646

Merged
darrachequesne merged 1 commit into
socketio:mainfrom
lamweili:rm-deprecated-substr
Jun 6, 2022
Merged

refactor: replace deprecated String.prototype.substr()#646
darrachequesne merged 1 commit into
socketio:mainfrom
lamweili:rm-deprecated-substr

Conversation

@lamweili

@lamweili lamweili commented Jun 4, 2022

Copy link
Copy Markdown
Contributor

The kind of change this PR does introduce

  • a bug fix
  • a new feature
  • an update to the documentation
  • a code change that improves performance
  • other

Current behaviour

Deprecated String.prototype.substr() is used.

New behaviour

String.prototype.slice() is used instead.

Other information (e.g. related issues)

Apart from changing all String.prototype.substr() to String.prototype.slice(), also changed String.prototype.substring() to String.prototype.slice() for consistency so there are no two different functions that are doing the essentially the same thing.

In addition, removed // eslint-disable-line node/no-deprecated-api as it is redundant following PR #565.

`.substr()` is deprecated so we replace it with `.slice()` which works similarily but isn't deprecated

Signed-off-by: Lam Wei Li <peteriman@mail.com>
@darrachequesne
darrachequesne merged commit 917d1d2 into socketio:main Jun 6, 2022
@darrachequesne

Copy link
Copy Markdown
Member

@peteriman thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants