UNPKG

vremel

Version:

JavaScript date utility library for Temporal API

47 lines 1.31 kB
import { isInstant, isPlainDate, isPlainDateTime, isPlainMonthDay, isPlainTime, isPlainYearMonth, isZonedDateTime, } from "../type-utils.js"; export function isEqual(a, b) { if (isInstant(a)) { if (!isInstant(b)) { throw new Error("Unmatched type"); } return a.equals(b); } if (isZonedDateTime(a)) { if (!isZonedDateTime(b)) { throw new Error("Unmatched type"); } return a.equals(b); } if (isPlainDate(a)) { if (!isPlainDate(b)) { throw new Error("Unmatched type"); } return a.equals(b); } if (isPlainTime(a)) { if (!isPlainTime(b)) { throw new Error("Unmatched type"); } return a.equals(b); } if (isPlainDateTime(a)) { if (!isPlainDateTime(b)) { throw new Error("Unmatched type"); } return a.equals(b); } if (isPlainYearMonth(a)) { if (!isPlainYearMonth(b)) { throw new Error("Unmatched type"); } return a.equals(b); } if (isPlainMonthDay(a)) { if (!isPlainMonthDay(b)) { throw new Error("Unmatched type"); } return a.equals(b); } throw new Error("Unknown type"); } //# sourceMappingURL=_equals.js.map