@silverwind/ioredis-mock
Version:
This library emulates ioredis by performing all operations in-memory.
20 lines (15 loc) • 330 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.zcard = zcard;
function zcard(key) {
const map = this.data.get(key);
if (!map) {
return 0;
}
if (!(map instanceof Map)) {
throw new Error(`Key ${key} does not contain a sorted set`);
}
return this.data.get(key).size;
}