refactor(desktop): organize lib modules by domain
This commit is contained in:
1 parent
90f0594e93
commit
7e7c4944e9
700 files changed
+1292
-1264
No files matched your search
@@ -0,0 +1,22 @@
|
||||
export function nextRedisCommandDb(currentDb: number, command: string, result: unknown): number {
|
||||
if (result !== "OK") return currentDb;
|
||||
|
||||
const match = command.trim().match(/^SELECT\s+(\d+)\s*;?$/i);
|
||||
if (!match) return currentDb;
|
||||
|
||||
const nextDb = Number.parseInt(match[1], 10);
|
||||
return Number.isFinite(nextDb) ? nextDb : currentDb;
|
||||
}
|
||||
|
||||
export function isRedisClearScreenCommand(command: string): boolean {
|
||||
return /^(clear|cls)\s*;?$/i.test(command.trim());
|
||||
}
|
||||
|
||||
export function redisKeyTextToRaw(key: string): string {
|
||||
const bytes = new TextEncoder().encode(key);
|
||||
let binary = "";
|
||||
for (const byte of bytes) {
|
||||
binary += String.fromCharCode(byte);
|
||||
}
|
||||
return btoa(binary);
|
||||
}
|
||||
Reference in new issue
Block a user