UNPKG

waveorb

Version:

Waveorb Javascript web app development framework

12 lines (10 loc) 334 B
const lodash = require('lodash') module.exports = function operate($, name) { return async function (obj, list) { if (typeof list == 'string') list = [list] if (typeof list == 'function') list = await list($) return Array.isArray(obj) ? obj.map((x) => lodash[name](x, list)) : lodash[name](obj, list) } }