njs icon indicating copy to clipboard operation
njs copied to clipboard

Destructuring/selective import support

Open iamhere2 opened this issue 3 years ago • 0 comments

It would be nice if njs supported destructuring/selective style for import: import { export1 , export2 } from "module-name";

Without that support, we have to write ugly things, if we need only one or two functions and prefer short naming:

import utils from 'utils.js';

const is_string = utils.is_string;
...
if (is_string(x)) {
...
}

BTW, it seems to be similar in implementation with destructuring assignment support (var {a, b} = o), which is also desired, but not supported yet.

iamhere2 avatar Sep 16 '21 10:09 iamhere2