const auth = createAPI => (...args) => { const result = createAPI(...args) return {
...result, headers: {...result.headers, authorization: `Bearer ${TOKEN}`},
}
}const projects = team => { return { url: `/api/0/teams/${team}/projects/`,
}
}
root(auth(projects))('fe')// 返回值如下{ headers: {authorization: "Bearer 123"}
url: "//www.baidu.com/api/0/teams/fe/projects/"}
不理解這段函數(shù)式編程,看不懂,誰能詳細(xì)解釋下?
### 你期待的結(jié)果是什么?實(shí)際看到的錯(cuò)誤信息又是什么?
不理解這段函數(shù)式編程,看不懂
慕娘9325324
2018-08-23 17:12:09