await redis.rpush("key", "a", "b", "c"); 
const index = await redis.lpos("key", "b");
console.log(index); // 1

Arguments

key
string
required
The key of the list.
element
unknown
required
The element to match.
opts
rank
number
The rank of the element to match. If specified, the element at the given rank is matched instead of the first element.
count
number
The maximum number of elements to match. If specified, an array of elements is returned instead of a single element.
maxLen
number
Limit the number of comparisons to perform.

Response

The index of the matching element or an array of indexes if opts.count is specified.
await redis.rpush("key", "a", "b", "c"); 
const index = await redis.lpos("key", "b");
console.log(index); // 1