This is likely because you were using
tests.mjs as an entry point for Mocha. I caught an oversight which let side loaded cases such as Mocha loading
require which shouldn’t be allowed. To avoid this you can use the
.js extension or rename your
tests-main.mjs and make your entry
Can @std/esm be configured to fall back to CommonJS semantics when a .js file is found (i.e., like the Babel imports plugin does)? Or do I need to convert all of my .js imports to requires?
@std/esm loader can be configured with
"cjs":true to enable importing named exports of CJS files.
@Invoker You can
require("@std/esm") in the entry script of your package and then use
export in modules loaded from the entry script after that point.
This boils down to “Don’t let user inputs set the length of your for-loop”.
“Collection” methods have existed in Underscore since its start in 2009. Like similar jQuery methods, their appeal is that they work with array-like values as well as objects. Lodash bases its array-like detection off of how ES6 handles array-like…