/
githubmirror
/
immutable-js
Обзор
Документация
Войти
/
githubmirror
/
immutable-js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/predicates/isSet.ts
16 строк
485 B
Julien Deniau
import comments into TS files
23 фев 2025, 22:59
23 фев 2025, 22:59
c16cbcf
Код
Авторство
О чём код?
import type { Set } from '../../type-definitions/immutable'; export const IS_SET_SYMBOL = '@@__IMMUTABLE_SET__@@'; /** * True if `maybeSet` is a Set. * * Also true for OrderedSets. */ export function isSet(maybeSet: unknown): maybeSet is Set<unknown> { return Boolean( maybeSet && // @ts-expect-error: maybeSet is typed as `{}`, need to change in 6.0 to `maybeSeq && typeof maybeSet === 'object' && MAYBE_SET_SYMBOL in maybeSet` maybeSet[IS_SET_SYMBOL] ); }