zoukankan      html  css  js  c++  java
  • [Ramda] Pluck & Props: Get the prop(s) from object array

    Pluck:

    Get one prop from the object array:

    R.pluck('a')([{a: 1}, {a: 2}]); //=> [1, 2]
    R.pluck(0)([[1, 2], [3, 4]]);   //=> [1, 3]

    Props:

    R.props(['x', 'y'], {x: 1, y: 2}); //=> [1, 2]
    R.props(['c', 'a', 'b'], {b: 2, a: 1}); //=> [undefined, 1, 2]
    
    var fullName = R.compose(R.join(' '), R.props(['first', 'last']));
    fullName({last: 'Bullet-Tooth', age: 33, first: 'Tony'}); //=> 'Tony Bullet-Tooth'
  • 相关阅读:
    iou与giou对比
    Linux学习第一天 vim
    奖励加分申请
    人月神话阅读笔记3
    5.27
    5.26
    5.25
    5.23
    5.22
    5.21
  • 原文地址:https://www.cnblogs.com/Answer1215/p/5944394.html
Copyright © 2011-2022 走看看