UNPKG

@silverwind/ioredis-mock

Version:

This library emulates ioredis by performing all operations in-memory.

20 lines (15 loc) 323 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.scard = scard; function scard(key) { const set = this.data.get(key); if (!set) { return 0; } if (!(set instanceof Set)) { throw new Error(`Key ${key} does not contain a set`); } return this.data.get(key).size; }