less.js icon indicating copy to clipboard operation
less.js copied to clipboard

chore: replace deprecated String.prototype.substr()

Open CommanderRoot opened this issue 3 years ago • 2 comments

What:

Replacing usage of .substr() with .slice()

Why:

String.prototype.substr() is deprecated.

Checklist:

  • [ ] Documentation N/A
  • [ ] Added/updated unit tests N/A
  • [x] Code complete

CommanderRoot avatar Mar 18 '22 00:03 CommanderRoot

Thanks for your contribution, @matthew-dean sir, what'r you opinion ? Do we need replace substr with slice now? (To be honest, I never use substr on my own code.

iChenLei avatar Mar 18 '22 08:03 iChenLei

Oh interesting, I had no idea it was deprecated. However, I'm wary of this drop-in replace with .slice. The MDN document doesn't say that it's a drop-in replacement, and gives a different polyfill.

matthew-dean avatar May 04 '22 14:05 matthew-dean