Thursday 18 May 2017

ES6 module import a function value

I see a lot of node librairies using this syntax:

var lib = require('lib')({someOptionalsOptions: 'foobar'});

I was wondering what was the ES6 equivalent ?

For now, I use the following syntax:

import libfunc from 'lib';
var lib = libfunc({someOptionalsOptions: 'foobar'});

Is there a more elegant way to perform this import ?



via bguyl

No comments:

Post a Comment