@@ -2,7 +2,7 @@ const slash = require('slash')
22const path = require ( 'path' )
33const patterns = require ( './patterns' )
44const { latest } = require ( './enterprise-server-releases' )
5- const allProducts = require ( './all-products' )
5+ const { productIds } = require ( './all-products' )
66const allVersions = require ( './all-versions' )
77const supportedVersions = new Set ( Object . keys ( allVersions ) )
88const nonEnterpriseDefaultVersion = require ( './non-enterprise-default-version' )
@@ -43,7 +43,7 @@ function getVersionStringFromPath (href) {
4343 const versionFromPath = href . split ( '/' ) [ 1 ]
4444
4545 // If the first segment is a supported product, assume this is FPT
46- if ( allProducts [ versionFromPath ] ) {
46+ if ( productIds . includes ( versionFromPath ) ) {
4747 return nonEnterpriseDefaultVersion
4848 }
4949
@@ -85,7 +85,7 @@ function getProductStringFromPath (href) {
8585
8686 if ( pathParts . includes ( 'early-access' ) ) return 'early-access'
8787
88- return allProducts [ pathParts [ 2 ] ]
88+ return productIds . includes ( pathParts [ 2 ] )
8989 ? pathParts [ 2 ]
9090 : pathParts [ 1 ]
9191}
@@ -99,27 +99,19 @@ function getCategoryStringFromPath (href) {
9999
100100 if ( pathParts . includes ( 'early-access' ) ) return null
101101
102- const productIndex = allProducts [ pathParts [ 2 ] ]
102+ const productIndex = productIds . includes ( pathParts [ 2 ] )
103103 ? 2
104104 : 1
105105
106106 return pathParts [ productIndex + 1 ]
107107}
108108
109- // Return the corresponding object for the product segment in a path
110- function getProductObjectFromPath ( href ) {
111- const productFromPath = getProductStringFromPath ( href )
112-
113- return allProducts [ productFromPath ]
114- }
115-
116109module . exports = {
117110 getPathWithLanguage,
118111 getPathWithoutLanguage,
119112 getPathWithoutVersion,
120113 getVersionStringFromPath,
121114 getVersionObjectFromPath,
122115 getProductStringFromPath,
123- getCategoryStringFromPath,
124- getProductObjectFromPath
116+ getCategoryStringFromPath
125117}
0 commit comments