Loading...
Loading...
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.
npx skill4agent add theorcdev/8bitcn-ui js-set-map-lookupsconst allowedIds = ['a', 'b', 'c', ...]
items.filter(item => allowedIds.includes(item.id))const allowedIds = new Set(['a', 'b', 'c', ...])
items.filter(item => allowedIds.has(item.id))