refactor: replace 'substr' with 'slice' (#4575)

* chore(deps): synchronize package-lock.json

Ran
up to date, audited 1936 packages in 2s

162 packages are looking for funding
  run `npm fund` for details

18 vulnerabilities (2 moderate, 14 high, 2 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details. without making explicit package changes. Synchronizing the package-lock.json file to maintain consistency.

* refactor: replace 'substr' with 'slice'

'substr' is deprecated. To ensure long-term code compatibility and clarity, it has been replaced with 'slice'. This adjustment aligns the codebase with current best practices.
This commit is contained in:
bhanu prasad 2023-08-23 01:46:40 +05:30 committed by GitHub
parent ca230e2b4c
commit 6be5578e8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 27 deletions

View file

@ -22711,27 +22711,6 @@
"signal-exit": "^3.0.2"
}
},
"node_modules/ws": {
"version": "8.11.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz",
"integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==",
"dev": true,
"engines": {
"node": ">=10.0.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"utf-8-validate": "^5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
"optional": true
},
"utf-8-validate": {
"optional": true
}
}
},
"node_modules/xtend": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",

View file

@ -71,7 +71,7 @@ class PseudolangWordGenerator extends Wordset {
this.ngrams[prefix] = new CharDistribution();
}
this.ngrams[prefix].addChar(c);
prefix = (prefix + c).substr(-prefixSize);
prefix = (prefix + c).slice(-prefixSize);
}
}
}
@ -79,7 +79,7 @@ class PseudolangWordGenerator extends Wordset {
public override randomWord(): string {
let word = "";
for (;;) {
const prefix = word.substr(-prefixSize);
const prefix = word.slice(-prefixSize);
const charDistribution = this.ngrams[prefix];
if (!charDistribution) {
// This shouldn't happen if this.ngrams is complete. If it does

View file

@ -815,7 +815,7 @@ export function findGetParameter(
}
search
.substr(1)
.slice(1)
.split("&")
.forEach(function (item) {
tmp = item.split("=");
@ -837,7 +837,7 @@ export function checkIfGetParameterExists(
}
search
.substr(1)
.slice(1)
.split("&")
.forEach(function (item) {
tmp = item.split("=");

View file

@ -22235,7 +22235,7 @@ class WordGenerator extends Wordset {
this.ngrams[prefix] = new CharDistribution();
}
this.ngrams[prefix].addChar(c);
prefix = (prefix + c).substr(-prefixSize);
prefix = (prefix + c).slice(-prefixSize);
}
}
}
@ -22243,7 +22243,7 @@ class WordGenerator extends Wordset {
randomWord() {
let word = "";
for (;;) {
const prefix = word.substr(-prefixSize);
const prefix = word.slice(-prefixSize);
let charDistribution = this.ngrams[prefix];
if (!charDistribution) {
// This shouldn't happen if this.ngrams is complete. If it does