digitalfabrik/integreat-app

View on GitHub
shared/utils/normalizePath.ts

Summary

Maintainability
A
0 mins
Test Coverage
import normalizePath from 'normalize-path'

import { NOT_FOUND_ROUTE } from '../routes'

const normalize = (value: string): string => {
  try {
    return decodeURIComponent(normalizePath(value)).toLowerCase()
  } catch (_) {
    return NOT_FOUND_ROUTE
  }
}

export default normalize