I'm looking for lodash function that able to transform/map/filter a single value with array of functions, for example:
given value to be: " a, b ,c"
and then call lodash with function like: _.transform(value, functionList)
which functionList is array of functions to split and trimEach.
expected result is ['a', 'b', 'c'].
UPDATE:
Thanks for @vlaz, _.flow() is that what I'm looking for.
The example I gave above is illustrated the purpose of function. I'm not looking for how to split and trim string (sorry, may be my english is not good enough).
To answer my own questions (and my example), the example code is:
function split(v) {
return v.split(',')
}
function trimStrArray(v) {
return _.map(v, _.trim)
}
var fn = _.flow([split, trimStrArray])
console.log(fn(" a, b ,c"))
<script src="https://cdn.jsdelivr.net/lodash/4.15.0/lodash.min.js"></script>
Thanks to everyone.
_.flow, is that what you are looking for?