diff --git a/src/JSONIterableNode.js b/src/JSONIterableNode.js index d670b8b..2f1f4f8 100644 --- a/src/JSONIterableNode.js +++ b/src/JSONIterableNode.js @@ -25,7 +25,7 @@ function renderItemString({ // Returns the child nodes for each entry in iterable. // If we have generated them previously we return from cache; otherwise we create them. -function getChildNodes({ +export function getChildNodes({ data, getItemString, labelRenderer, diff --git a/src/index.js b/src/index.js index e8b567e..d5c7dd0 100644 --- a/src/index.js +++ b/src/index.js @@ -5,8 +5,10 @@ import React from 'react'; import grabNode from './grab-node'; +import objType from './obj-type'; import solarized from './themes/solarized'; -import {getChildNodes} from './JSONObjectNode'; +import { getChildNodes as getObjectChildNodes } from './JSONObjectNode'; +import { getChildNodes as getIterableChildNodes } from './JSONIterableNode'; const styles = { tree: { @@ -77,6 +79,7 @@ export default class JSONTree extends React.Component { } = this.props; let nodeToRender; + let getChildNodes = objType(value) === 'Iterable' ? getIterableChildNodes : getObjectChildNodes; if (!this.props.hideRoot) { nodeToRender = grabNode({