refactor: replace deprecated String.prototype.substr() (#10432)

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

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
This commit is contained in:
CommanderRoot
2022-03-31 19:49:56 +02:00
committed by GitHub
parent 0d744d30f2
commit 200f0b2e4f
19 changed files with 26 additions and 26 deletions

View File

@@ -1491,7 +1491,7 @@ describe('Sorted Set methods', () => {
await db.sortedSetAdd('sortedSetLexSearch', [0, 0, 0], ['baris:usakli:1', 'baris usakli:2', 'baris soner:3']);
const query = 'baris:';
const min = query;
const max = query.substr(0, query.length - 1) + String.fromCharCode(query.charCodeAt(query.length - 1) + 1);
const max = query.slice(0, -1) + String.fromCharCode(query.charCodeAt(query.length - 1) + 1);
const result = await db.getSortedSetRangeByLex('sortedSetLexSearch', min, max, 0, -1);
assert.deepStrictEqual(result, ['baris:usakli:1']);
});