better-assert
better-assert copied to clipboard
c-style assert() for nodejs, reporting the expression string as the error message
The current version is 8 commits behind. Furthermore, the newest version of the npm package does not yet include the license (see #11).
`TypeError: Cannot read property '1' of null` The callsite returns a line number for compiled code but it's trying to read the line from uncompiled one.
Works for babel 7. Augments #16, fixes #12. See fork https://github.com/GerHobbelt/better-assert for `npm test` tests including babel transpiled runs. The key problem was when using a modern `import assert from...
Basically if you name the assert function other than "assert" the regex fails. ```javascript const betterAss = require("./index"); betterAss(1 === 2); ``` ``` ~/better-assert/index.js:30 var src = line.match(/assert\((.*)\)/)[1]; ^ TypeError:...
The issues are closed there so I have to put my doubts here, although not so relevant: It is unworthy to assert in browsers, considering the overheads in brand-width. It...
As the regex is configured at the moment, it is not possible to have line breaks in the code that is to be asserted. This could be fixed either by...