mirror of
https://github.com/tcgdex/javascript-sdk.git
synced 2025-08-05 03:51:59 +00:00
feat: Allow a user to filters elements on the API (#275)
This commit is contained in:
20
src/utils.ts
Normal file
20
src/utils.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { Endpoints } from './interfaces'
|
||||
|
||||
/**
|
||||
* detect the current running context ofthe program
|
||||
*/
|
||||
export function detectContext(): 'browser' | 'server' {
|
||||
try {
|
||||
const isBrowser = !!window
|
||||
return isBrowser ? 'browser' : 'server'
|
||||
} catch {
|
||||
return 'server'
|
||||
}
|
||||
}
|
||||
|
||||
export const ENDPOINTS: Array<Endpoints> = [
|
||||
'cards', 'categories', 'dex-ids', 'energy-types',
|
||||
'hp', 'illustrators', 'rarities', 'regulation-marks',
|
||||
'retreats', 'series', 'sets', 'stages', 'suffixes',
|
||||
'trainer-types', 'types', 'variants'
|
||||
] as const
|
Reference in New Issue
Block a user