Group Array Elements By Value Javascript Substring Email