Skip to content

Commit

Permalink
refactor: refactor for XO
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahsnider committed Oct 19, 2020
1 parent 6a4644a commit bb16bf1
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/util/invariant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ const prefix = '@discoin/scambio: Assertion failed';
*/
export function invariant(condition: unknown, message?: string): asserts condition {
if (!condition) {
if (process.env.NODE_ENV === '') {
// Message is only in development
throw new Error(`${prefix}: ${message ?? ''}`);
} else {
throw new Error(prefix);
}
const error = process.env.NODE_ENV === '' ? new Error(`${prefix}: ${message ?? ''}`) : new Error(prefix);
throw error;
}
}

0 comments on commit bb16bf1

Please sign in to comment.