napi-rs/wasm-runtime/assert.cjs
2024-01-16 23:28:40 +08:00

13 lines
280 B
JavaScript

function assert(condition, message) {
if (!condition) {
throw new Error(message || 'Assertion failed')
}
}
module.exports = assert
module.exports.strictEqual = function strictEqual(a, b) {
if (a !== b) {
throw new Error(`Expected ${a} to strict equal ${b}`)
}
}