Replace deprecated substr with substring (#355)

* Make the QueryRunner more readable

* Remove use of deprecated substr and replace with substring, and some formatting
This commit is contained in:
CosminPerRam 2023-09-13 17:31:58 +03:00 committed by GitHub
parent 65dd876252
commit 5b01e1be17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 66 additions and 61 deletions

View file

@ -64,9 +64,9 @@ function splitFields(str,subMode) {
}
for (const one of split) {
const equal = one.indexOf(splitter);
const key = equal === -1 ? one : one.substr(0,equal);
const key = equal === -1 ? one : one.substring(0,equal);
if(!key || key === '\0') continue;
const value = equal === -1 ? '' : one.substr(equal+splitter.length);
const value = equal === -1 ? '' : one.substring(equal+splitter.length);
if(!subMode && key === 'CHANNEL') out.CHANNELS.push(splitFields(value,true));
else if(!subMode && key === 'CLIENT') out.CLIENTS.push(splitFields(value,true));
else out[key] = value;