Underscore.js: how to chain custom functions

前端 未结 7 1359
南方客
南方客 2020-12-31 01:11

Using Underscore.js, I can write the following which returns 42:

_([42, 43]).chain()
    .first()
    .value()

I have custom f

相关标签:
7条回答
  • 2020-12-31 02:13

    Looks like lodash has implemented exactly what you are looking for:

    _.thru(value, interceptor)
    

    from the docs:

    This method is like _.tap except that it returns the result of interceptor

    https://lodash.com/docs#thru

    0 讨论(0)
提交回复
热议问题