I have this piece of javascript code:
function arrayMapper(mappingFunc) {
return items => items.map(mappingFunc);
}
function fooTransformer(tem) {
return (...);
}
function barTransformer(tem) {
return (...);
}
const foosTransformer = arrayMapper(fooTransformer);
const barsTransformer = arrayMapper(barTransformer);
(...)
foosTransformer([1, 2, 3]);
I was wondering if something like my function arrayMapperwould initially exist in something like lodash, just so as not to reinvent the wheel.
Guid source
share