Debian Codegraph @

packages/bloom/lib/commands/count-min-sketch/INCRBY.ts

raw
1 export const FIRST_KEY_INDEX = 1;
2
3 interface IncrByItem {
4 item: string;
5 incrementBy: number;
6 }
7
8 export function transformArguments(
9 key: string,
10 items: IncrByItem | Array<IncrByItem>
11 ): Array<string> {
12 const args = ['CMS.INCRBY', key];
13
14 if (Array.isArray(items)) {
15 for (const item of items) {
16 pushIncrByItem(args, item);
17 }
18 } else {
19 pushIncrByItem(args, items);
20 }
21
22 return args;
23 }
24
25 function pushIncrByItem(args: Array<string>, { item, incrementBy }: IncrByItem): void {
26 args.push(item, incrementBy.toString());
27 }
28
29 export declare function transformReply(): Array<number>;