better-assert
better-assert copied to clipboard
Error when importing using a different name than "assert"
Basically if you name the assert function other than "assert" the regex fails.
const betterAss = require("./index");
betterAss(1 === 2);
~/better-assert/index.js:30
var src = line.match(/assert\((.*)\)/)[1];
^
TypeError: Cannot read property '1' of null
at assert (~/better-assert/index.js:30:41)
at Object.<anonymous> (~/better-assert/fn-name-test.js:4:1)
+1