We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a773539 commit 03302c9Copy full SHA for 03302c9
sdks/ts/src/utils/invariant.ts
@@ -1,7 +1,13 @@
1
+/**
2
+ * Ensures that a condition is met, throwing a custom error message if not.
3
+ * @param condition The condition to test. If falsy, an error is thrown.
4
+ * @param message Optional. The error message to throw if the condition is not met. Defaults to "Invariant Violation".
5
+ */
6
export function invariant(
7
condition: any,
8
message: string = "Invariant Violation",
9
): void {
10
+ // Throw an error with the provided message if the condition is falsy
11
if (!condition) {
12
throw new Error(message);
13
}
0 commit comments