TWorldIsNButThis

能否用 lodash/fp 表达 find one or get first? point free 且 lazy 的那种

  •  
  •   TWorldIsNButThis · Mar 7, 2022 · 1208 views
    This topic created in 1554 days ago, the information mentioned may be changed or developed.

    正常的写法是

    const findOneOrGetFirst = (predicate) => (someTypeList) => someTypeList.find(predicate) || someTypeList[0]
    

    这种写法能否转成 point free 的形式呢? 也就是用函数的组合表达那个逻辑或

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5366 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 08:00 · PVG 16:00 · LAX 01:00 · JFK 04:00
    ♥ Do have faith in what you're doing.