Skip to content
This repository has been archived by the owner on Nov 22, 2018. It is now read-only.

Commit

Permalink
feat(sismember): adds validation
Browse files Browse the repository at this point in the history
  • Loading branch information
nileshmali committed Aug 9, 2017
1 parent dd9449d commit b747fbb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/commands/sismember.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export function sismember(key: string, value: any) {
const set = this.data.get(key) || new Set();
if (!(set instanceof Set)) {
throw new Error(`Key ${key} does not contain a set`);
}
return set.has(value) ? 1 : 0;
}

0 comments on commit b747fbb

Please sign in to comment.