This library parses container image names.
A more complete reference implementation in Go can be found here: https://github.com/docker/distribution/blob/da8db4666b08431e701b044c9077648533d97b7e/reference/reference.go
const { parse } = require("docker-reference-parser");
const result = parse("hello-world:latest");
console.log(result);