@virtualstate/navigation
Version:
Native JavaScript [navigation](https://developer.mozilla.org/en-US/docs/Web/API/Navigation_API) implementation
16 lines • 516 B
JavaScript
export function isEvent(value) {
function isLike(value) {
return !!value;
}
return (isLike(value) &&
(typeof value.type === "string" || typeof value.type === "symbol"));
}
export function assertEvent(value, type) {
if (!isEvent(value)) {
throw new Error("Expected event");
}
if (typeof type !== "undefined" && value.type !== type) {
throw new Error(`Expected event type ${String(type)}, got ${value.type.toString()}`);
}
}
//# sourceMappingURL=event.js.map