Prefer Set.has() over Array.includes()
SkillFiles & storagePrefer Set.has() over Array.includes() for constant allowlists/blocklists. Read this when reviewing or writing membership checks in TypeScript files.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Prefer Set.has() over Array.includes() skill
What this skill tells your AI
The instructions your AI receives, as published by ledgerhq/ledger-live in .agents/skills/prefer-set-has/SKILL.md and read by ahel’s review.
When checking membership in a constant list of known values (allowlists, blocklists, enum-like sets), use a Set with .has() instead of an array with .includes().
// ❌ BAD
const ALLOWED = ["a", "b", "c"];
if (ALLOWED.includes(value)) { … }
// ✅ GOOD
const ALLOWED = new Set(["a", "b", "c"]);
if (ALLOWED.has(value)) { … }
Why: Set.has() is O(1) vs .includes() O(n), communicates "membership test" intent more clearly, and avoids accidental mutation of the backing array.
When .includes() is fine: Searching within a dynamic or short-lived array (e.g. function parameters, user input) where creating a Set would add noise.
Signals
- GitHub stars
- 618
- Forks
- 490
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
prefer-set-has- Source
- github.com/ledgerhq/ledger-live