function wrapChildNodes(parentNode) {
        var index = 0;

        Immutable.List(parentNode.childNodes)
          .filterNot(function(node) {
            return nodeHelpers.isWhitespaceOnlyTextNode(Node, node);
          })
          .filter(function(node) {
            return node.nodeType === Node.TEXT_NODE || !nodeHelpers.isBlockElement(node);
          })
          .groupBy(function(node, key, list) {
            return key === 0 || node.previousSibling === list.get(key - 1) ?
              index :
              index += 1;
          })
          .forEach(function(nodeGroup) {
            nodeHelpers.wrap(nodeGroup.toArray(), document.createElement('p'));
          });
      }
Wrap consecutive inline elements and text nodes in a P element.