common.ts 254 Bytes EditWeb IDE 1 2 3 4 5 6 7 8 9 export const assert = (condition: () => boolean, reason?: string) => { try { if (condition() === false) { throw new Error(`Assertion failed: ${reason}`) } } catch (err) { throw new Error(`Assertion failed: ${reason}\n${err}`) } }