@njx, removeMenuDivider() is public, it is exposed through exports.Menu, but it's a pretty new API, I just wrote it to support removeMenu().  Regardless, I think it would be better to keep the parameter as is because the data object behind the menu items, menuItemMap, is keyed off of the full menuItemID.  I would just have to rebuild the key name again from the child menu id for that code.

I like your first idea.  I will change to lastindexOf() and I will also look for string "brackets-menuDivider-" which should be sufficient to prevent menu name collisions.