cjs/react.development.js
/**
 * `formatElements` - parse string and return tree of react elements
 *
 * `value` is string to be formatted with <0>Paired<0/> or <0/> (unpaired)
 * placeholders. `elements` is a array of react elements which indexes
 * correspond to element indexes in formatted string
 */
`formatElements` - parse string and return tree of react elements
`value` is string to be formatted with <0>Paired<0/> or <0/> (unpaired)
placeholders. `elements` is a array of react elements which indexes
correspond to element indexes in formatted string
` formatElements ` - parse string and return tree of react elements ` value ` is string to be formatted with <0 > Paired<0 / > or <0 / > ( unpaired ) placeholders . ` elements ` is a array of react elements which indexes correspond to element indexes in formatted string
function formatElements(value) {
  var elements = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  var parts = value.replace(nlRe, "").split(tagRe);
  if (parts.length === 1) return value;
  var tree = [];
  var before = parts.shift();
  if (before) tree.push(before);
  var _iteratorNormalCompletion = true;
  var _didIteratorError = false;
  var _iteratorError = undefined;
  try {
    for (var _iterator = _getIterator(getElements(parts)), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
      var _ref = _step.value;
      var _ref2 = _slicedToArray(_ref, 3);
      var index = _ref2[0];
      var children = _ref2[1];
      var after = _ref2[2];
      var element = elements[index];
      tree.push(React.cloneElement(element, { key: index },
      children ? formatElements(children, elements) : element.props.children));
      if (after) tree.push(after);
    }
  } catch (err) {
    _didIteratorError = true;
    _iteratorError = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion && _iterator.return) {
        _iterator.return();
      }
    } finally {
      if (_didIteratorError) {
        throw _iteratorError;
      }
    }
  }
  return tree;
}
function formatElements ( value ) { var elements = arguments . length > 1 && arguments [ 1 ] !== undefined ? arguments [ 1 ] : [ ] ; var parts = value . replace ( nlRe , "" ) . split ( tagRe ) ; if ( parts . length === 1 ) return value ; var tree = [ ] ; var before = parts . shift ( ) ; if ( before ) tree . push ( before ) ; var _iteratorNormalCompletion = true ; var _didIteratorError = false ; var _iteratorError = undefined ; try { for ( var _iterator = _getIterator ( getElements ( parts ) ) , _step ; ! ( _iteratorNormalCompletion = ( _step = _iterator . next ( ) ) . done ) ; _iteratorNormalCompletion = true ) { var _ref = _step . value ; var _ref2 = _slicedToArray ( _ref , 3 ) ; var index = _ref2 [ 0 ] ; var children = _ref2 [ 1 ] ; var after = _ref2 [ 2 ] ; var element = elements [ index ] ; tree . push ( React . cloneElement ( element , { key : index } , children ? formatElements ( children , elements ) : element . props . children ) ) ; if ( after ) tree . push ( after ) ; } } catch ( err ) { _didIteratorError = true ; _iteratorError = err ; } finally { try { if ( ! _iteratorNormalCompletion && _iterator . return ) { _iterator . return ( ) ; } } finally { if ( _didIteratorError ) { throw _iteratorError ; } } } return tree ; }
`formatElements` - parse string and return tree of react elements
 `value` is string to be formatted with <0>Paired<0/> or <0/> (unpaired)
 placeholders.
` formatElements ` - parse string and return tree of react elements ` value ` is string to be formatted with <0 > Paired<0 / > or <0 / > ( unpaired ) placeholders .
// TODO: warn if there're any unprocessed elements // TODO: warn if element at `index` doesn't exist // no inline elements, return // format children for pair tags // unpaired tags might have children if it's a component passed as a variable