( path )
| 171 | } |
| 172 | |
| 173 | export async function getNetlifyRedirect ( path ) { |
| 174 | // Check if the path is valid |
| 175 | // by checking if it starts with a slash |
| 176 | // and does not end with a slash |
| 177 | // if ( !path.startsWith('/') || path.endsWith('/') ) { |
| 178 | // throw new Error(`Invalid Netlify redirect path: ${ path }`) |
| 179 | // } |
| 180 | |
| 181 | const netlifyConfig = await getNetlifyConfig() |
| 182 | const redirects = netlifyConfig.redirects |
| 183 | |
| 184 | for ( const redirect of redirects ) { |
| 185 | // Check if the from path is valid |
| 186 | // by checking if it starts with a slash |
| 187 | // and does not end with a slash |
| 188 | if ( !redirect.from.startsWith('/') || redirect.from.endsWith('/') ) { |
| 189 | throw new Error(`Invalid Netlify redirect.from path: ${ redirect.from }`) |
| 190 | } |
| 191 | |
| 192 | if ( redirect.from === path ) { |
| 193 | return redirect |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | return null |
| 198 | } |
| 199 | |
| 200 | export function makeTitle ( listing ) { |
| 201 | return `Does ${ listing.name } work on Apple Silicon? - ${ nuxtHead.title }` |
no test coverage detected