vremel
Version:
JavaScript date utility library for Temporal API
16 lines • 520 B
JavaScript
import { compare } from "./datetime/_compare.js";
import { getTypeName } from "./type-utils.js";
/** @internal */
export function assertSameType(a, b) {
if (getTypeName(a) !== getTypeName(b)) {
throw new Error(`Temporal type mismatch: ${getTypeName(a)} and ${getTypeName(b)}`);
}
}
/** @internal */
export function assertValidInterval(i) {
assertSameType(i.start, i.end);
if (compare(i.start, i.end) === 1) {
throw new Error("Invalid interval");
}
}
//# sourceMappingURL=assert.js.map