code: function _removeDotSegments(path) {
      if (path == '/')
          return '/';
      var /** @type {?} */ leadingSlash = path[0] == '/' ? '/' : '';
      var /** @type {?} */ trailingSlash = path[path.length - 1] === '/' ? '/' : '';
      var /** @type {?} */ segments = path.split('/');
      var /** @type {?} */ out = [];
      var /** @type {?} */ up = 0;
      for (var /** @type {?} */ pos = 0; pos < segments.length; pos++) {
          var /** @type {?} */ segment = segments[pos];
          switch (segment) {
              case '':
              case '.':
                  break;
              case '..':
                  if (out.length > 0) {
                      out.pop();
                  }
                  else {
                      up++;
                  }
                  break;
              default:
                  out.push(segment);
          }
      }
      if (leadingSlash == '') {
          while (up-- > 0) {
              out.unshift('..');
          }
          if (out.length === 0)
              out.push('.');
      }
      return leadingSlash + out.join('/') + trailingSlash;
  }
docs: Removes dot segments in given path component, as described in
  RFC 3986, section 5.2.4.
  
  @param {?} path A non-empty path component.
  @return {?} Path component with removed dot segments.