https://github.com/metabrainz/musicbrainz-server/blob/abe40fc/root/static/scripts/edit/externalLinks.js#L240-L278 is messy and can be improved:
- The isNewOrChangedLink check is repeated 6 times. We can use a nested "if" here.
- We can factor out the parts that check only the URL or only the link type into separate functions & reduce the amount of inline logic inside the map.
- One large "if" chain doesn't seem ideal. We should probably store and display the errors as a list, since multiple may apply at once.