UNPKG

@crpt/react-list

Version:
17 lines (11 loc) 614 B
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } import { map } from 'lodash'; var defaultChildren = function defaultChildren(ownProps) { var renderItem = ownProps.renderItem, passProps = _objectWithoutProperties(ownProps, ['renderItem']); var data = passProps.data; return typeof renderItem === 'function' ? map(data, function (item) { return renderItem(item, passProps); }) : null; }; export default defaultChildren;