function getVersion()

in functions/version-policy.js [5:9]


function getVersion(path) {
  const url = new URL(path, 'https://foo.bar');
  const segments = url.pathname.split('/');
  return segments.find((segment) => segment.match(/v[0-9]+(.[0-9]+)?/));
}