Skip to content

Commit

Permalink
add validator
Browse files Browse the repository at this point in the history
  • Loading branch information
silesky committed Apr 11, 2023
1 parent 2f7815c commit 42ed459
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/core/src/validation/assertions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ export function assertUserIdentity(event: CoreSegmentEvent): void {
export function assertEventExists(
event?: CoreSegmentEvent | null
): asserts event is CoreSegmentEvent {
if (!event || typeof event !== 'object') {
if (!exists(event)) {
throw new ValidationError('Event', nilError)
}
if (typeof event !== 'object') {
throw new ValidationError('Event', objError)
}
}

export function assertEventType(event: CoreSegmentEvent): void {
Expand Down

0 comments on commit 42ed459

Please sign in to comment.