码迷,mamicode.com
首页 > 其他好文 > 详细

[Ramda] Simple log function for debugging Compose function

时间:2016-09-04 06:48:57      阅读:126      评论:0      收藏:0      [点我收藏+]

标签:

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

标签:

原文地址:http://www.cnblogs.com/Answer1215/p/5838513.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!