UNPKG

@kermank/slots

Version:

A TypeScript library for handling time slots, scheduling, and timezone operations

32 lines (31 loc) 835 B
import { Slot } from './slot'; import { MetadataMerger } from './metadata'; import { Duration } from 'luxon'; /** * Generic operation result type */ export type OperationResult<T> = { data: T; error?: string; }; /** * Type for any function that operates on slots */ export type SlotOperator<T> = (slots: Slot[], metadataMerger?: MetadataMerger) => OperationResult<T>; /** * Available set operations for slots */ export type SlotSetOperation = 'union' | 'intersection' | 'difference' | 'symmetric_difference'; /** * Result of a slot operation */ export type SlotOperationResult = Slot[]; /** * Options for slot operations */ export interface SlotOperationOptions { metadataMerger: MetadataMerger; edgeStrategy?: EdgeStrategy; minDuration?: Duration; } export type EdgeStrategy = 'inclusive' | 'exclusive';