Functional programming Ramda中带列表头的管道obj键列表

Functional programming Ramda中带列表头的管道obj键列表,functional-programming,pipe,ramda.js,Functional Programming,Pipe,Ramda.js,我怎么用管道输送呢 R.keys(obj)返回一个列表 R.head应获得列表的第一项 我错过了什么 const obj = {f: "hi"} const keysList = R.keys(obj); const head = R.head(keysList); const myPipe = R.pipe(keysList , head ) //? R.pipe需要一个函数列表,并返回一个新函数。调用该函数时,传递给该函数的任何参数都将传递给管道中的第一个函数,第一个函数的结果

我怎么用管道输送呢

R.keys(obj)返回一个列表 R.head应获得列表的第一项 我错过了什么

const obj = {f: "hi"}     
const keysList = R.keys(obj);
const head = R.head(keysList);

const myPipe = R.pipe(keysList , head ) //?

R.pipe需要一个函数列表,并返回一个新函数。调用该函数时,传递给该函数的任何参数都将传递给管道中的第一个函数,第一个函数的结果将传递给下一个函数,依此类推

在本例中,您尝试创建一个如下所示的函数:

o => R.head(R.keys(o))
这相当于:

R.pipe(R.keys, R.head)
例如:

const obj={f:“hi”}
const myPipe=R.pipe(R.key,R.head)
常量结果=myPipe(obj)
console.log(结果)