chayns-components
Version:
A set of beautiful React components for developing chayns® applications.
36 lines (34 loc) • 916 B
JavaScript
;
exports.__esModule = true;
exports.default = getList;
var _is = require("../../utils/is");
function getList(data, orm, inputValue) {
let retVal = [];
if (Array.isArray(orm.groups)) {
orm.groups.forEach(_ref => {
let {
key,
show,
filter
} = _ref;
if (!((0, _is.isFunction)(show) && !show(inputValue))) {
let list;
if (filter) {
list = data[key].filter(filter(inputValue));
} else {
list = data[key];
}
retVal = retVal.concat(list);
}
});
} else {
Object.keys(data).forEach(key => {
if (!(orm && orm.groups && orm.groups[key] && (0, _is.isFunction)(orm.groups[key].filter)) || orm.groups[key].filter(inputValue)(data[key])) {
const item = data[key];
retVal = retVal.concat(item);
}
});
}
return retVal;
}
//# sourceMappingURL=getList.js.map