b8d075ef0e
* Remove req.env * Rename NEXT_APP_ to NEXT_PUBLIC_ * Remove key exposing env config * Update tests * Update NEXT_APP_ test to NEXT_PUBLIC_
16 lines
503 B
TypeScript
16 lines
503 B
TypeScript
import { BLOCKED_PAGES } from '../lib/constants'
|
|
|
|
export function isBlockedPage(pathname: string): boolean {
|
|
return BLOCKED_PAGES.indexOf(pathname) !== -1
|
|
}
|
|
|
|
export function cleanAmpPath(pathname: string): string {
|
|
if (pathname.match(/\?amp=(y|yes|true|1)/)) {
|
|
pathname = pathname.replace(/\?amp=(y|yes|true|1)&?/, '?')
|
|
}
|
|
if (pathname.match(/&=(y|yes|true|1)/)) {
|
|
pathname = pathname.replace(/&=(y|yes|true|1)/, '')
|
|
}
|
|
pathname = pathname.replace(/\?$/, '')
|
|
return pathname
|
|
}
|