kwk / docker-registry-frontend

Browse and modify your Docker registry in a browser.
https://registry.hub.docker.com/u/konradkleine/docker-registry-frontend/
MIT License
1.68k stars 616 forks source link

🎨Clean up the next link parser #193

Open bvanderlaan opened 6 years ago

bvanderlaan commented 6 years ago

Per the TODO: Can we clean this up a bit? this change set cleans up the code used to parse out the last value via the next link header.

In the current implementation we use substring, indexOf, and replace which results in a bit of nesting and unclear code. This change set updates that code to use Regular Expressions and named functions to make the code more clear.

Tests were added to ensure hat this refactor didn't break anything