Skip to content

Commit

Permalink
chore: rename utils to core
Browse files Browse the repository at this point in the history
  • Loading branch information
oedotme committed Oct 29, 2022
1 parent 2dd4bd9 commit 0fa3991
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/utils.tsx → src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const patterns = {
type PreservedKey = '_app' | '404'
type BaseRoute = { path?: string; children?: BaseRoute[] } & Record<string, any>

export const generatePreservedRoutes = <T,>(routes: Record<string, T | any>): Partial<Record<PreservedKey, T>> => {
export const generatePreservedRoutes = <T>(routes: Record<string, T | any>): Partial<Record<PreservedKey, T>> => {
return Object.keys(routes).reduce((result, current) => {
const path = current.replace(...patterns.route)
return { ...result, [path]: routes[current]?.default }
Expand Down
2 changes: 1 addition & 1 deletion src/react-location.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Fragment } from 'react'
import { LoaderFn, Outlet, ReactLocation, Route, Router, RouterProps } from '@tanstack/react-location'

import { generatePreservedRoutes, generateRegularRoutes } from './utils'
import { generatePreservedRoutes, generateRegularRoutes } from './core'

type Element = () => JSX.Element
type Module = { default: Element; Loader: LoaderFn; Pending: Element; Failure: Element }
Expand Down
2 changes: 1 addition & 1 deletion src/react-router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Fragment, lazy, Suspense } from 'react'
import { createBrowserRouter, Outlet, RouterProvider } from 'react-router-dom'
import type { ActionFunction, RouteObject, LoaderFunction } from 'react-router-dom'

import { generatePreservedRoutes, generateRegularRoutes } from './utils'
import { generatePreservedRoutes, generateRegularRoutes } from './core'

type Element = () => JSX.Element
type Module = { default: Element; Loader: LoaderFunction; Action: ActionFunction }
Expand Down

0 comments on commit 0fa3991

Please sign in to comment.