Skip to content

Commit

Permalink
code: String.substr deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiocabral committed Nov 22, 2021
1 parent 8912f99 commit c1162df
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ts/Application/BotTwitch/BotTwitchApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export class BotTwitchApplication extends Application<BotTwitchConfiguration> {
userMessage.startsWith(`${prefix} `.toLowerCase())
);
if (commandPrefix !== undefined) {
return message.message.substr(commandPrefix.length).trim();
return message.message.substring(commandPrefix.length).trim();
}
}

Expand Down
2 changes: 1 addition & 1 deletion ts/Database/Redis/RedisDatabase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export class RedisDatabase extends Database<RedisConfiguration> {
const keyPrefix = this.formatKey(table);
this.redis.keys(`${keyPrefix}*`, (error, keys) => {
if (!error) {
keys = keys.map((key) => key.substr(keyPrefix.length + 1));
keys = keys.map((key) => key.substring(keyPrefix.length + 1));
resolve(keys);
} else {
reject();
Expand Down
3 changes: 1 addition & 2 deletions ts/UserInteraction/CommandLine/CommandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ export class CommandLineParser {
const regexIsQuoted = new RegExp(`^([${quotes}]).*\\1$`);
const isQuoted = regexIsQuoted.test(argument);
if (isQuoted) {
const twoQuotesLength = 2;
argument = argument
.substr(1, argument.length - twoQuotesLength)
.substring(1, argument.length - 1)
.replace(/\0/g, " ");
} else {
argument = argument.trim();
Expand Down

0 comments on commit c1162df

Please sign in to comment.