Files
Compass/web/lib/util/ship-util.ts
Martin Braquet ba9b3cfb06 Add pretty formatting (#29)
* Test

* Add pretty formatting

* Fix Tests

* Fix Tests

* Fix Tests

* Fix

* Add pretty formatting fix

* Fix

* Test

* Fix tests

* Clean typeckech

* Add prettier check

* Fix api tsconfig

* Fix api tsconfig

* Fix tsconfig

* Fix

* Fix

* Prettier
2026-02-20 17:32:27 +01:00

22 lines
585 B
TypeScript

import {ShipData} from 'common/api/profile-types'
import {User} from 'common/user'
export const hasShipped = (
currentUser: User | null | undefined,
target1Id: string | undefined,
target2Id: string | undefined,
ships: ShipData[],
) => {
return Boolean(
currentUser &&
target1Id &&
target2Id &&
ships.some(
({creator_id, target1_id, target2_id}) =>
creator_id === currentUser.id &&
((target1_id === target1Id && target2_id === target2Id) ||
(target1_id === target2Id && target2_id === target1Id)),
),
)
}