code: function parseRepoAndRef(arg, defaultIndex) {
      // Parse off the tag/digest per
      // JSSTYLED
      // https://github.com/docker/docker/blob/0c7b51089c8cd7ef3510a9b40edaa139a7ca91aa/pkg/parsers/parsers.go#L69
      var repo, tag, digest;
      var atIdx = arg.lastIndexOf('@');
      if (atIdx !== -1) {
          repo = arg.slice(0, atIdx);
          digest = arg.slice(atIdx + 1);
      } else {
          var colonIdx = arg.lastIndexOf(':');
          var slashIdx = arg.lastIndexOf('/');
          if (colonIdx !== -1 && colonIdx > slashIdx) {
              repo = arg.slice(0, colonIdx);
              tag = arg.slice(colonIdx + 1);
          } else {
              repo = arg;
          }
      }
  
      var info = parseRepo(repo, defaultIndex);
      if (digest) {
          info.digest = digest;
      } else if (tag) {
          info.tag = tag;
      } else {
          info.tag = DEFAULT_TAG;
      }
  
      return info;
  }
docs: Parse a docker repo and tag/digest string: [INDEX/]REPO[:TAG|@DIGEST]
  
  Examples:
  busybox
  busybox:latest
  google/python:3.3
  docker.io/ubuntu
  localhost:5000/blarg
  http://localhost:5000/blarg:latest
  alpine@sha256:fb9f16730ac6316afa4d97caa5130219927bfcecf0b0...
  
  Dev Notes:
  - TODO Validation on digest and tag would be nice.
  
  @param arg {String} The docker repo:tag string to parse. See examples above.
  @param defaultIndex {Object|String} Optional. The default index to use
  if not specified with `arg`. If not given the default is 'docker.io'.
  If given it may either be a string, e.g. 'https://myreg.example.com',
  or parsed index object, as from `parseIndex()`.