0

in node (common-js), i can do something similar to the following:

resultA = require('objectA').key1;
//
resultB = require('functionB')(42);
//
resultC = require('functionC')();

with es6/2015 modules, i'm currently using something similar to this:

import objectA from 'objectA'; 
resultA = objectA.key1;
//
import functionB from 'functionB'; 
resultB = functionB(42);
//
import functionC from 'functionC'; 
resultC = functionC();

is there a short-hand syntax available, or is this the most concise way of accomplishing the desired behavior?

tony_k
  • 1,983
  • 2
  • 20
  • 27
  • Actually, it's not a duplicate. –  Jun 08 '15 at 16:47
  • You'd have to elaborate then, because that seems like the same question to me. Or are you referring to the fact that those answers use a module loader instead of import syntax? The answer is still the same, there is no way, an import statement just defines variable names like `var someImport;` – loganfsmyth Jun 08 '15 at 23:07
  • 1
    @torazaburo: Yeah, the question is a bit off with "*is there a more concise way?*" instead of "*what's the best way?*", but the answers in the dupe already do show the most concise way; the answer to this question would be a simple **No** (which is too short to post it as an answer) – Bergi Jun 09 '15 at 01:24
  • See also [How to import part of object in ES6 modules](http://stackoverflow.com/questions/30121801/how-to-import-part-of-object-in-es6-modules) – Bergi Aug 03 '15 at 14:18

0 Answers0