1// ${host}/${repoPath}:${tag} -> {repoPath, tag} (host stripped) 2// tag may be a digest: ${host}/${repoPath}@sha256:abc -> {repoPath, tag: 'sha256:abc'} 3export const parseRepoNameTag = (repo_name_tag: string): {repoPath: string, tag: string} => { 4 const rest = repo_name_tag.slice(repo_name_tag.indexOf('/') + 1) 5 const atIdx = rest.lastIndexOf('@') 6 if (atIdx >= 0) return {repoPath: rest.slice(0, atIdx), tag: rest.slice(atIdx + 1)} 7 const lastColon = rest.lastIndexOf(':') 8 return {repoPath: rest.slice(0, lastColon), tag: rest.slice(lastColon + 1)}