[Ramda] Simple log function for debugging Compose function

Posted Answer1215

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[Ramda] Simple log function for debugging Compose function相关的知识,希望对你有一定的参考价值。

const log = function(x){
  console.log(x);
  return x;
}

const get = R.curry(function(prop, obj){
  return obj[prop];
})

var people = [
  {name: "Wan"},
  {name: "Zhentian"}
];

var res = R.compose(
  get(‘name‘),
  log,
  R.head
)(people);

console.log(res);

 

以上是关于[Ramda] Simple log function for debugging Compose function的主要内容,如果未能解决你的问题,请参考以下文章