Function: parseRepositoryTag()
parseRepositoryTag(
input):RepositoryTag
Split an image reference into its repository and its tag (or digest). A digest (@) wins over a tag; the port of a registry (registry:5000/app) is not taken for a tag.
Parameters
input
string
The image reference: alpine, alpine:3.20, registry.example.com:5000/team/app:1.0, alpine@sha256:….
Returns
The repository, and the tag (or the digest, without its @) when the reference has one.
Example
typescript
import {parseRepositoryTag, type RepositoryTag} from 'lakutata/com/docker'
const reference: RepositoryTag = parseRepositoryTag('registry.example.com:5000/team/app:1.0')
console.log(reference) //{repo: 'registry.example.com:5000/team/app', tag: '1.0'}
console.log(parseRepositoryTag('registry.example.com:5000/team/app')) //{repo: 'registry.example.com:5000/team/app'}