/
Alex_Ural
/
opencode
Обзор
Документация
Войти
/
Alex_Ural
/
opencode
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
packages/codemode/src/stdlib/collections.ts
51 строка
1 KB
Aiden Cline
feat(codemode): sync v2 implementation (#35574)
06 июл 2026, 21:19
Не верифицирован
06 июл 2026, 21:19
d5aa79c
Код
Авторство
О чём код?
export const arrayMethods = new Set([ "map", "filter", "find", "findIndex", "findLast", "findLastIndex", "some", "every", "includes", "join", "reduce", "reduceRight", "flatMap", "forEach", "sort", "toSorted", "slice", "concat", "indexOf", "lastIndexOf", "at", "flat", "reverse", "toReversed", "with", "push", "pop", "shift", "unshift", "splice", "fill", "copyWithin", "keys", "values", "entries", ]) export const mapMethods = new Set(["get", "set", "has", "delete", "clear", "forEach", "keys", "values", "entries"]) export const setMethods = new Set(["add", "has", "delete", "clear", "forEach", "keys", "values", "entries"]) export const spreadItems = (value: unknown): Array<unknown> | undefined => { if (Array.isArray(value)) return value if (typeof value === "string") return Array.from(value) if (value instanceof SandboxMap) return Array.from(value.map.entries(), ([key, item]) => [key, item]) if (value instanceof SandboxSet) return Array.from(value.set.values()) if (value instanceof SandboxURLSearchParams) return Array.from(value.params.entries(), ([key, item]) => [key, item]) return undefined } import { SandboxMap, SandboxSet, SandboxURLSearchParams } from "../values.js"