Allow non-array value to be passed into listItems

Useful in some scenarios when using JSX
This commit is contained in:
Toby Zerner 2015-09-04 12:16:23 +09:30
parent c373065ab1
commit 601f7adb0f

View File

@ -23,10 +23,12 @@ function withoutUnnecessarySeparators(items) {
* The `listItems` helper wraps a collection of components in <li> tags,
* stripping out any unnecessary `Separator` components.
*
* @param {Array} items
* @param {*} items
* @return {Array}
*/
export default function listItems(items) {
if (!(items instanceof Array)) items = [items];
return withoutUnnecessarySeparators(items).map(item => {
const isListItem = item.component && item.component.isListItem;
const active = item.component && item.component.isActive && item.component.isActive(item.props);