src/data/parser.js
function groupsFactory() {
  let list = []

  const getGroupsByRoot = function(root) {
    for (let i = 0; i < list.length; i++) {
      let groups = list[i]
      if (groups.rootEl === root) {
        return groups
      }
    }
    return null
  }

  return {
    add: function(root, group) {
      let groups = getGroupsByRoot(root)
      if (!groups) {
        groups = new Groups(root, [])
        list.push(groups)
      }
      if (group) {
        group._list = groups
        group.resolve()

        groups.add(group)
      }
    },
    groups: function() {
      return list.length === 1 ? list[0] : list
    }
  }
}
function groupsFactory() {
  let list = []

  const getGroupsByRoot = function(root) {
    for (let i = 0; i < list.length; i++) {
      let groups = list[i]
      if (groups.rootEl === root) {
        return groups
      }
    }
    return null
  }

  return {
    add: function(root, group) {
      let groups = getGroupsByRoot(root)
      if (!groups) {
        groups = new Groups(root, [])
        list.push(groups)
      }
      if (group) {
        group._list = groups
        group.resolve()

        groups.add(group)
      }
    },
    groups: function() {
      return list.length === 1 ? list[0] : list
    }
  }
}
function groupsFactory ( ) { let list = [ ] const getGroupsByRoot = function ( root ) { for ( let i = 0 ; i < list . length ; i ++ ) { let groups = list [ i ] if ( groups . rootEl === root ) { return groups } } return null } return { add : function ( root , group ) { let groups = getGroupsByRoot ( root ) if ( ! groups ) { groups = new Groups ( root , [ ] ) list . push ( groups ) } if ( group ) { group . _list = groups group . resolve ( ) groups . add ( group ) } } , groups : function ( ) { return list . length === 1 ? list [ 0 ] : list } } }
Create groups factory

@return {{add: {function} add, groups: {array|Groups} groups}}
Create groups factory