/
githubmirror
/
immutable-js
Обзор
Документация
Войти
/
githubmirror
/
immutable-js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/predicates/isValueObject.ts
18 строк
673 B
Julien Deniau
import comments into TS files
23 фев 2025, 22:59
23 фев 2025, 22:59
c16cbcf
Код
Авторство
О чём код?
import type { ValueObject } from '../../type-definitions/immutable'; /** * True if `maybeValue` is a JavaScript Object which has *both* `equals()` * and `hashCode()` methods. * * Any two instances of *value objects* can be compared for value equality with * `Immutable.is()` and can be used as keys in a `Map` or members in a `Set`. */ export function isValueObject(maybeValue: unknown): maybeValue is ValueObject { return Boolean( maybeValue && // @ts-expect-error: maybeValue is typed as `{}` typeof maybeValue.equals === 'function' && // @ts-expect-error: maybeValue is typed as `{}` typeof maybeValue.hashCode === 'function' ); }