Is there a shorter ES6 way of doing:
var assert = require('chai').assert;
than
import chai from 'chai'; var assert = chai.assert;
(chai is the chai-assertion library, in case you haven't heard of it yet.)
ES6 modules are automatically strict-mode code, even if you don't write "use strict"; in them. You can use import and export in modules.
Yes, you can do it like:
import { assert } from 'chai';
assert
must be exporting from chai
in that case. See spec here and about es6 modules here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With