lib/browser/api/menu.js
function generateGroupId (items, pos) {
  if (pos > 0) {
    for (let idx = pos - 1; idx >= 0; idx--) {
      if (items[idx].type === 'radio') return items[idx].groupId
      if (items[idx].type === 'separator') break
    }
  } else if (pos < items.length) {
    for (let idx = pos; idx <= items.length - 1; idx++) {
      if (items[idx].type === 'radio') return items[idx].groupId
      if (items[idx].type === 'separator') break
    }
  }
  groupIdIndex += 1
  return groupIdIndex
}
function generateGroupId (items, pos) {
  if (pos > 0) {
    for (let idx = pos - 1; idx >= 0; idx--) {
      if (items[idx].type === 'radio') return items[idx].groupId
      if (items[idx].type === 'separator') break
    }
  } else if (pos < items.length) {
    for (let idx = pos; idx <= items.length - 1; idx++) {
      if (items[idx].type === 'radio') return items[idx].groupId
      if (items[idx].type === 'separator') break
    }
  }
  groupIdIndex += 1
  return groupIdIndex
}
function generateGroupId ( items , pos ) { if ( pos > 0 ) { for ( let idx = pos - 1 ; idx >= 0 ; idx -- ) { if ( items [ idx ] . type === 'radio' ) return items [ idx ] . groupId if ( items [ idx ] . type === 'separator' ) break } } else if ( pos < items . length ) { for ( let idx = pos ; idx <= items . length - 1 ; idx ++ ) { if ( items [ idx ] . type === 'radio' ) return items [ idx ] . groupId if ( items [ idx ] . type === 'separator' ) break } } groupIdIndex += 1 return groupIdIndex }
Search between separators to find a radio menu item and return its group id
Search between separators to find a radio menu item and return its group id