Skip to main content

js-set-map-lookups

Use Set and Map for O(1) membership lookups instead of array.includes(). Apply when checking membership repeatedly or performing frequent lookups against a collection.

소스 정보

저장소
TheOrcDev/8bitcn-ui
최근 소스 활동
2026년 1월 16일 09:09
감지된 SKILL.md 언어
영어
스타
2,049
포크
121

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
js-set-map-lookups
description
Use Set and Map for O(1) membership lookups instead of array.includes(). Apply when checking membership repeatedly or performing frequent lookups against a collection.
## Use Set/Map for O(1) Lookups Convert arrays to Set/Map for repeated membership checks. **Incorrect (O(n) per check):** ```typescript const allowedIds = ['a', 'b', 'c', ...] items.filter(item => allowedIds.includes(item.id)) ``` **Correct (O(1) per check):** ```typescript const allowedIds = new Set(['a', 'b', 'c', ...]) items.filter(item => allowedIds.has(item.id)) ```
GitHub에서 보기