js-set-map-lookups

📁 theorcdev/8bitcn-ui 📅 Jan 23, 2026
18
总安装量
12
周安装量
#19092
全站排名
安装命令
npx skills add https://github.com/theorcdev/8bitcn-ui --skill js-set-map-lookups

Agent 安装分布

claude-code 9
opencode 8
codex 8
windsurf 8
gemini-cli 7
antigravity 7

Skill 文档

Use Set/Map for O(1) Lookups

Convert arrays to Set/Map for repeated membership checks.

Incorrect (O(n) per check):

const allowedIds = ['a', 'b', 'c', ...]
items.filter(item => allowedIds.includes(item.id))

Correct (O(1) per check):

const allowedIds = new Set(['a', 'b', 'c', ...])
items.filter(item => allowedIds.has(item.id))