mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 18:13:25 +00:00
Basically library structure
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Fetcher } from '@/utils/fetcher';
|
||||
import { UseableFetcher } from '@/fetchers/types';
|
||||
|
||||
export interface ScrapeContext {
|
||||
proxiedFetcher: Fetcher;
|
||||
fetcher: Fetcher;
|
||||
proxiedFetcher: UseableFetcher;
|
||||
fetcher: UseableFetcher;
|
||||
progress(val: number): void;
|
||||
}
|
||||
|
@@ -1,11 +0,0 @@
|
||||
export type FetcherOptions = {
|
||||
baseUrl?: string;
|
||||
headers?: Record<string, string>;
|
||||
query?: Record<string, string>;
|
||||
method?: 'GET' | 'POST';
|
||||
body?: Record<string, any> | string | FormData;
|
||||
};
|
||||
|
||||
export type Fetcher<T = any> = {
|
||||
(url: string, ops?: FetcherOptions): T;
|
||||
};
|
7
src/utils/predicates.ts
Normal file
7
src/utils/predicates.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export function isNotNull<T>(value: T | null | undefined): value is T {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
|
||||
export function hasDuplicates<T>(values: Array<T>): boolean {
|
||||
return new Set(values).size !== values.length;
|
||||
}
|
Reference in New Issue
Block a user