导出默认咖喱功能

时间:2020-04-30 13:51:58

标签: javascript functional-programming currying

我正在一家具有全球存储(Vuex)的SPA中工作,并且正在对服务/实用程序进行编码以使用数据源。以下方法导出默认咖喱功能正确吗?

const curryFuction1 = (token) => async (params) => {
    // CODE
}
const curryFuction2 = (token) => async (params) => {
    // CODE
}

export default (token) => ({
  moduleCurryFunction1: curryFuction1(token),
  moduleCurryFunction2: curryFuction2(token),
});

// Consumed as following:

const result = await MyModule(token).moduleCurryFunction1(params)

0 个答案:

没有答案