ES6 shorthand import

ecmascript-6import

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.)

Best Solution

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