is it possible to destrucure my import statements2019 Community Moderator ElectionIs it possible to do multiple class imports with ES6/Babel?Is it possible to add dynamically named properties to JavaScript object?Use of .apply() with 'new' operator. Is this possible?How to apply !important using .css()?How to check if an object is an array?Using node.js as a simple web serverIs it possible to apply CSS to half of a character?Using Node.js require vs. ES6 import/exportES6: Conditional & Dynamic Import StatementsWhen should I use curly braces for ES6 import?Node.js - SyntaxError: Unexpected token import
An Undercover Army
Create chunks from an array
What is the meaning of "notice to quit at once" and "Lotty points”
Misplaced tyre lever - alternatives?
Can I solder 12/2 Romex to extend wire 5 ft?
Find maximum of the output from reduce
Can a Trickery Domain cleric cast a spell through the Invoke Duplicity clone while inside a Forcecage?
How do we objectively assess if a dialogue sounds unnatural or cringy?
Should we avoid writing fiction about historical events without extensive research?
function only contains jump discontinuity but is not piecewise continuous
Why do phishing e-mails use faked e-mail addresses instead of the real one?
The need of reserving one's ability in job interviews
What is the difference between 主菜 and 主食?
Is there a full canon version of Tyrion's jackass/honeycomb joke?
Is there a way to find out the age of climbing ropes?
Did Amazon pay $0 in taxes last year?
Is every open circuit a capacitor?
Plagiarism of code by other PhD student
Why is it "take a leak?"
Can we carry rice to Japan?
How can I conditionally format my HTML table?
Relationship between the symmetry number of a molecule as used in rotational spectroscopy and point group
Called into a meeting and told we are being made redundant (laid off) and "not to share outside". Can I tell my partner?
How does signal strength relate to bandwidth?
is it possible to destrucure my import statements
2019 Community Moderator ElectionIs it possible to do multiple class imports with ES6/Babel?Is it possible to add dynamically named properties to JavaScript object?Use of .apply() with 'new' operator. Is this possible?How to apply !important using .css()?How to check if an object is an array?Using node.js as a simple web serverIs it possible to apply CSS to half of a character?Using Node.js require vs. ES6 import/exportES6: Conditional & Dynamic Import StatementsWhen should I use curly braces for ES6 import?Node.js - SyntaxError: Unexpected token import
i want to write below import in one single line. is it possible?
`import SellerAdaptor from '../adaptors/sellers';
import UserAdaptor from '../adaptors/user';
import ShopEarnAdaptor from '../adaptors/shop_earn';
import ProductAdaptor from '../adaptors/product';
import JobAdaptor from '../adaptors/job';
import OrderAdaptor from '../adaptors/order';
import NotificationAdaptor from '../adaptors/notification';
import CategoryAdaptor from '../adaptors/category';
import AdminAdaptor from '../adaptors/adminAdaptor';`
javascript node.js ecmascript-6
add a comment |
i want to write below import in one single line. is it possible?
`import SellerAdaptor from '../adaptors/sellers';
import UserAdaptor from '../adaptors/user';
import ShopEarnAdaptor from '../adaptors/shop_earn';
import ProductAdaptor from '../adaptors/product';
import JobAdaptor from '../adaptors/job';
import OrderAdaptor from '../adaptors/order';
import NotificationAdaptor from '../adaptors/notification';
import CategoryAdaptor from '../adaptors/category';
import AdminAdaptor from '../adaptors/adminAdaptor';`
javascript node.js ecmascript-6
2
Why'd you do that? What's wrong with multiline imports?
– yunzen
19 hours ago
2
Remove the line breaks, and it would be one single line....
– Usagi Miyamoto
19 hours ago
2
Do the back ticks (`) belong to your code?
– yunzen
19 hours ago
1
no you can't but if you need to you can create a factory like module for all imports check this stackoverflow.com/questions/34648195/…
– AZ_
19 hours ago
since all of those modules live underadaptors
, you might as well create anindex.js
file and put all the exports in there. Given that, all the consumers willimport ... from '../adaptors'
– Hitmands
19 hours ago
add a comment |
i want to write below import in one single line. is it possible?
`import SellerAdaptor from '../adaptors/sellers';
import UserAdaptor from '../adaptors/user';
import ShopEarnAdaptor from '../adaptors/shop_earn';
import ProductAdaptor from '../adaptors/product';
import JobAdaptor from '../adaptors/job';
import OrderAdaptor from '../adaptors/order';
import NotificationAdaptor from '../adaptors/notification';
import CategoryAdaptor from '../adaptors/category';
import AdminAdaptor from '../adaptors/adminAdaptor';`
javascript node.js ecmascript-6
i want to write below import in one single line. is it possible?
`import SellerAdaptor from '../adaptors/sellers';
import UserAdaptor from '../adaptors/user';
import ShopEarnAdaptor from '../adaptors/shop_earn';
import ProductAdaptor from '../adaptors/product';
import JobAdaptor from '../adaptors/job';
import OrderAdaptor from '../adaptors/order';
import NotificationAdaptor from '../adaptors/notification';
import CategoryAdaptor from '../adaptors/category';
import AdminAdaptor from '../adaptors/adminAdaptor';`
javascript node.js ecmascript-6
javascript node.js ecmascript-6
asked 19 hours ago
Deepak TyagiDeepak Tyagi
166
166
2
Why'd you do that? What's wrong with multiline imports?
– yunzen
19 hours ago
2
Remove the line breaks, and it would be one single line....
– Usagi Miyamoto
19 hours ago
2
Do the back ticks (`) belong to your code?
– yunzen
19 hours ago
1
no you can't but if you need to you can create a factory like module for all imports check this stackoverflow.com/questions/34648195/…
– AZ_
19 hours ago
since all of those modules live underadaptors
, you might as well create anindex.js
file and put all the exports in there. Given that, all the consumers willimport ... from '../adaptors'
– Hitmands
19 hours ago
add a comment |
2
Why'd you do that? What's wrong with multiline imports?
– yunzen
19 hours ago
2
Remove the line breaks, and it would be one single line....
– Usagi Miyamoto
19 hours ago
2
Do the back ticks (`) belong to your code?
– yunzen
19 hours ago
1
no you can't but if you need to you can create a factory like module for all imports check this stackoverflow.com/questions/34648195/…
– AZ_
19 hours ago
since all of those modules live underadaptors
, you might as well create anindex.js
file and put all the exports in there. Given that, all the consumers willimport ... from '../adaptors'
– Hitmands
19 hours ago
2
2
Why'd you do that? What's wrong with multiline imports?
– yunzen
19 hours ago
Why'd you do that? What's wrong with multiline imports?
– yunzen
19 hours ago
2
2
Remove the line breaks, and it would be one single line....
– Usagi Miyamoto
19 hours ago
Remove the line breaks, and it would be one single line....
– Usagi Miyamoto
19 hours ago
2
2
Do the back ticks (`) belong to your code?
– yunzen
19 hours ago
Do the back ticks (`) belong to your code?
– yunzen
19 hours ago
1
1
no you can't but if you need to you can create a factory like module for all imports check this stackoverflow.com/questions/34648195/…
– AZ_
19 hours ago
no you can't but if you need to you can create a factory like module for all imports check this stackoverflow.com/questions/34648195/…
– AZ_
19 hours ago
since all of those modules live under
adaptors
, you might as well create an index.js
file and put all the exports in there. Given that, all the consumers will import ... from '../adaptors'
– Hitmands
19 hours ago
since all of those modules live under
adaptors
, you might as well create an index.js
file and put all the exports in there. Given that, all the consumers will import ... from '../adaptors'
– Hitmands
19 hours ago
add a comment |
3 Answers
3
active
oldest
votes
No.
Destructuring would let you import many values from one module.
You can't import multiple modules at once.
A typical pattern here would be to have an ../adaptors/index
which imported all the modules and then exported them:
import SellerAdaptor from './sellers';
import UserAdaptor from './user';
// etc
export SellerAdaptor, UserAdaptor, etc ;
Then you would be able to:
import SellerAdaptor, UserAdaptor, etc from "../adaptors/index";
1
A better way to write this isexport default as SellerAdaptor from './sellers'
.
– estus
19 hours ago
add a comment |
To be able to write import A, B, C from 'myPackage'
, it's upon myPackage
and how it has been written.
If they are different files, you can't do it.
If you have one file adaptors
that export
the different modules, you can write your imports with the destructuring.
add a comment |
You can do like as follows:
import SellerAdaptor from '../adaptors/sellers';
import UserAdaptor from '../adaptors/user';
import ShopEarnAdaptor from '../adaptors/shop_earn';
import ProductAdaptor from '../adaptors/product';
import JobAdaptor from '../adaptors/job';
import OrderAdaptor from '../adaptors/order';
import NotificationAdaptor from '../adaptors/notification';
import CategoryAdaptor from '../adaptors/category';
import AdminAdaptor from '../adaptors/adminAdaptor';
export
SellerAdaptor,
UserAdaptor,
ShopEarnAdaptor,
ProductAdaptor,
JobAdaptor,
OrderAdaptor,
NotificationAdaptor,
CategoryAdaptor,
AdminAdaptor
And Then You can Import like as follows
import SellerAdaptor, UserAdaptor from './<filename>'
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55021525%2fis-it-possible-to-destrucure-my-import-statements%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
No.
Destructuring would let you import many values from one module.
You can't import multiple modules at once.
A typical pattern here would be to have an ../adaptors/index
which imported all the modules and then exported them:
import SellerAdaptor from './sellers';
import UserAdaptor from './user';
// etc
export SellerAdaptor, UserAdaptor, etc ;
Then you would be able to:
import SellerAdaptor, UserAdaptor, etc from "../adaptors/index";
1
A better way to write this isexport default as SellerAdaptor from './sellers'
.
– estus
19 hours ago
add a comment |
No.
Destructuring would let you import many values from one module.
You can't import multiple modules at once.
A typical pattern here would be to have an ../adaptors/index
which imported all the modules and then exported them:
import SellerAdaptor from './sellers';
import UserAdaptor from './user';
// etc
export SellerAdaptor, UserAdaptor, etc ;
Then you would be able to:
import SellerAdaptor, UserAdaptor, etc from "../adaptors/index";
1
A better way to write this isexport default as SellerAdaptor from './sellers'
.
– estus
19 hours ago
add a comment |
No.
Destructuring would let you import many values from one module.
You can't import multiple modules at once.
A typical pattern here would be to have an ../adaptors/index
which imported all the modules and then exported them:
import SellerAdaptor from './sellers';
import UserAdaptor from './user';
// etc
export SellerAdaptor, UserAdaptor, etc ;
Then you would be able to:
import SellerAdaptor, UserAdaptor, etc from "../adaptors/index";
No.
Destructuring would let you import many values from one module.
You can't import multiple modules at once.
A typical pattern here would be to have an ../adaptors/index
which imported all the modules and then exported them:
import SellerAdaptor from './sellers';
import UserAdaptor from './user';
// etc
export SellerAdaptor, UserAdaptor, etc ;
Then you would be able to:
import SellerAdaptor, UserAdaptor, etc from "../adaptors/index";
answered 19 hours ago
QuentinQuentin
651k728841047
651k728841047
1
A better way to write this isexport default as SellerAdaptor from './sellers'
.
– estus
19 hours ago
add a comment |
1
A better way to write this isexport default as SellerAdaptor from './sellers'
.
– estus
19 hours ago
1
1
A better way to write this is
export default as SellerAdaptor from './sellers'
.– estus
19 hours ago
A better way to write this is
export default as SellerAdaptor from './sellers'
.– estus
19 hours ago
add a comment |
To be able to write import A, B, C from 'myPackage'
, it's upon myPackage
and how it has been written.
If they are different files, you can't do it.
If you have one file adaptors
that export
the different modules, you can write your imports with the destructuring.
add a comment |
To be able to write import A, B, C from 'myPackage'
, it's upon myPackage
and how it has been written.
If they are different files, you can't do it.
If you have one file adaptors
that export
the different modules, you can write your imports with the destructuring.
add a comment |
To be able to write import A, B, C from 'myPackage'
, it's upon myPackage
and how it has been written.
If they are different files, you can't do it.
If you have one file adaptors
that export
the different modules, you can write your imports with the destructuring.
To be able to write import A, B, C from 'myPackage'
, it's upon myPackage
and how it has been written.
If they are different files, you can't do it.
If you have one file adaptors
that export
the different modules, you can write your imports with the destructuring.
answered 19 hours ago
HRK44HRK44
471214
471214
add a comment |
add a comment |
You can do like as follows:
import SellerAdaptor from '../adaptors/sellers';
import UserAdaptor from '../adaptors/user';
import ShopEarnAdaptor from '../adaptors/shop_earn';
import ProductAdaptor from '../adaptors/product';
import JobAdaptor from '../adaptors/job';
import OrderAdaptor from '../adaptors/order';
import NotificationAdaptor from '../adaptors/notification';
import CategoryAdaptor from '../adaptors/category';
import AdminAdaptor from '../adaptors/adminAdaptor';
export
SellerAdaptor,
UserAdaptor,
ShopEarnAdaptor,
ProductAdaptor,
JobAdaptor,
OrderAdaptor,
NotificationAdaptor,
CategoryAdaptor,
AdminAdaptor
And Then You can Import like as follows
import SellerAdaptor, UserAdaptor from './<filename>'
add a comment |
You can do like as follows:
import SellerAdaptor from '../adaptors/sellers';
import UserAdaptor from '../adaptors/user';
import ShopEarnAdaptor from '../adaptors/shop_earn';
import ProductAdaptor from '../adaptors/product';
import JobAdaptor from '../adaptors/job';
import OrderAdaptor from '../adaptors/order';
import NotificationAdaptor from '../adaptors/notification';
import CategoryAdaptor from '../adaptors/category';
import AdminAdaptor from '../adaptors/adminAdaptor';
export
SellerAdaptor,
UserAdaptor,
ShopEarnAdaptor,
ProductAdaptor,
JobAdaptor,
OrderAdaptor,
NotificationAdaptor,
CategoryAdaptor,
AdminAdaptor
And Then You can Import like as follows
import SellerAdaptor, UserAdaptor from './<filename>'
add a comment |
You can do like as follows:
import SellerAdaptor from '../adaptors/sellers';
import UserAdaptor from '../adaptors/user';
import ShopEarnAdaptor from '../adaptors/shop_earn';
import ProductAdaptor from '../adaptors/product';
import JobAdaptor from '../adaptors/job';
import OrderAdaptor from '../adaptors/order';
import NotificationAdaptor from '../adaptors/notification';
import CategoryAdaptor from '../adaptors/category';
import AdminAdaptor from '../adaptors/adminAdaptor';
export
SellerAdaptor,
UserAdaptor,
ShopEarnAdaptor,
ProductAdaptor,
JobAdaptor,
OrderAdaptor,
NotificationAdaptor,
CategoryAdaptor,
AdminAdaptor
And Then You can Import like as follows
import SellerAdaptor, UserAdaptor from './<filename>'
You can do like as follows:
import SellerAdaptor from '../adaptors/sellers';
import UserAdaptor from '../adaptors/user';
import ShopEarnAdaptor from '../adaptors/shop_earn';
import ProductAdaptor from '../adaptors/product';
import JobAdaptor from '../adaptors/job';
import OrderAdaptor from '../adaptors/order';
import NotificationAdaptor from '../adaptors/notification';
import CategoryAdaptor from '../adaptors/category';
import AdminAdaptor from '../adaptors/adminAdaptor';
export
SellerAdaptor,
UserAdaptor,
ShopEarnAdaptor,
ProductAdaptor,
JobAdaptor,
OrderAdaptor,
NotificationAdaptor,
CategoryAdaptor,
AdminAdaptor
And Then You can Import like as follows
import SellerAdaptor, UserAdaptor from './<filename>'
answered 19 hours ago
Sourabh SomaniSourabh Somani
1,142418
1,142418
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55021525%2fis-it-possible-to-destrucure-my-import-statements%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Why'd you do that? What's wrong with multiline imports?
– yunzen
19 hours ago
2
Remove the line breaks, and it would be one single line....
– Usagi Miyamoto
19 hours ago
2
Do the back ticks (`) belong to your code?
– yunzen
19 hours ago
1
no you can't but if you need to you can create a factory like module for all imports check this stackoverflow.com/questions/34648195/…
– AZ_
19 hours ago
since all of those modules live under
adaptors
, you might as well create anindex.js
file and put all the exports in there. Given that, all the consumers willimport ... from '../adaptors'
– Hitmands
19 hours ago