I have a javascript object that each attribute is a function:
(我有一个JavaScript对象,每个属性都是一个函数:)
{
SetBtcPrice: {
key: 'SetBtcPrice',
options: { repeat: [Object], backoff: [Object], attempts: 10 },
handle: [AsyncFunction: handle]
},
SetVenezuelanRate: {
key: 'SetVenezuelaRate',
options: { repeat: [Object], backoff: [Object], attempts: 10 },
handle: [AsyncFunction: handle]
}
}
I'm exporting it as export default { SetBtcPrice, SetVenezuelanRate };
(我将其导出为export default { SetBtcPrice, SetVenezuelanRate };
)
and I'm importing it in another file as import ExchangeRates from "./exchangeRates";
(我将其导入到另一个文件中作为import ExchangeRates from "./exchangeRates";
)
Then in this file I'm exporting the ExchangeRates
and another funtion:(然后在此文件中,导出ExchangeRates
和另一个功能:)
exchangeRates.js:
(exchangeRates.js:)
import SetBtcPrice from "./SetBtcPrice";
import SetVenezuelanRate from "./SetVenezuelaRate";
export default { SetBtcPrice, SetVenezuelanRate };
jobs/index.js:
(Jobs / index.js:)
export { default as UserRegistrationMail } from "./UserRegistrationMail";
import ExchangeRates from "./exchangeRates";
export { ExchangeRates };
In another file I'm importing import * as jobs from "../jobs";
(在另一个文件中,我将import * as jobs from "../jobs";
)
, this gives me:(,这给了我:)
{
UserRegistrationMail: [Getter],
ExchangeRates: {
SetBtcPrice: {
key: 'SetBtcPrice',
options: [Object],
handle: [AsyncFunction: handle]
},
SetVenezuelanRate: {
key: 'SetVenezuelaRate',
options: [Object],
handle: [AsyncFunction: handle]
}
}
}
How can I deconstruct the ExchangeRates
object, so when importing * as jobs
it gives me this:
(我该如何解构ExchangeRates
对象,因此在将* as jobs
导入* as jobs
会得到以下信息:)
{
UserRegistrationMail: [Getter],
SetBtcPrice: {
key: 'SetBtcPrice',
options: [Object],
handle: [AsyncFunction: handle]
},
SetVenezuelanRate: {
key: 'SetVenezuelaRate',
options: [Object],
handle: [AsyncFunction: handle]
}
}
ask by Otavio Bonder translate from so