-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
95 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
declare const __FROG_BASE_URL__: string | ||
export const baseUrl = __FROG_BASE_URL__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
import { hc } from 'hono/client' | ||
|
||
declare const __FROG_BASE_URL__: string | ||
const apiUrl = `${__FROG_BASE_URL__}/api` | ||
import { baseUrl } from '../constants.js' | ||
|
||
type Route = import('../../../src/dev/api.js').ApiRoutes | ||
export const client = hc<Route>(apiUrl) | ||
export const client = hc<Route>(`${baseUrl}/api`) | ||
|
||
export type Client = typeof client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** Forked from https://github.com/epoberezkin/fast-deep-equal */ | ||
export function deepEqual(a: any, b: any) { | ||
if (a === b) return true | ||
|
||
if (a && b && typeof a === 'object' && typeof b === 'object') { | ||
if (a.constructor !== b.constructor) return false | ||
|
||
let length: number | ||
let i: number | ||
|
||
if (Array.isArray(a) && Array.isArray(b)) { | ||
length = a.length | ||
if (length !== b.length) return false | ||
for (i = length; i-- !== 0; ) if (!deepEqual(a[i], b[i])) return false | ||
return true | ||
} | ||
|
||
if (a.valueOf !== Object.prototype.valueOf) | ||
return a.valueOf() === b.valueOf() | ||
if (a.toString !== Object.prototype.toString) | ||
return a.toString() === b.toString() | ||
|
||
const keys = Object.keys(a) | ||
length = keys.length | ||
if (length !== Object.keys(b).length) return false | ||
|
||
for (i = length; i-- !== 0; ) | ||
if (!Object.prototype.hasOwnProperty.call(b, keys[i]!)) return false | ||
|
||
for (i = length; i-- !== 0; ) { | ||
const key = keys[i] | ||
|
||
if (key && !deepEqual(a[key], b[key])) return false | ||
} | ||
|
||
return true | ||
} | ||
|
||
// true if both NaN, false otherwise | ||
// biome-ignore lint/suspicious/noSelfCompare: <explanation> | ||
return a !== a && b !== b | ||
} |