feat: implement FluentUrl class with configuration and options normalization
This commit is contained in:
33
lib/shared/types/index.d.ts
vendored
Normal file
33
lib/shared/types/index.d.ts
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/** biome-ignore-all lint/correctness/noUnusedVariables: <> */
|
||||
|
||||
type QueriesPlainObject = Record<string, any>
|
||||
|
||||
interface FLuentUrlPlainObject {
|
||||
protocol?: string
|
||||
hostname?: string
|
||||
paths: string[]
|
||||
port?: number
|
||||
fragment?: string
|
||||
queries: QueriesPlainObject
|
||||
}
|
||||
|
||||
interface QuerySerializer {
|
||||
parseQuery: (str: string) => QueriesPlainObject
|
||||
stringifyQuery: (obj: QueriesPlainObject) => string
|
||||
}
|
||||
|
||||
interface UrlSerializer {
|
||||
parseUrl: (args: {
|
||||
str: string
|
||||
parseQuery?: QuerySerializer['parseQuery']
|
||||
}) => FLuentUrlPlainObject
|
||||
stringifyUrl: (args: {
|
||||
obj: FLuentUrlPlainObject
|
||||
stringifyQuery?: QuerySerializer['stringifyQuery']
|
||||
}) => string
|
||||
}
|
||||
|
||||
interface FluentUrlConfig {
|
||||
parseQuery: Serializer['parseQuery']
|
||||
stringifyQuery: Serializer['stringifyQuery']
|
||||
}
|
||||
Reference in New Issue
Block a user