UNPKG

@nodesecure/js-x-ray

Version:
40 lines 1.47 kB
import { type SourceArrayLocation } from "./utils/toArrayLocation.ts"; export type Type = "url" | "hostname" | "ip" | "email" | "dependency" | (string & {}); export type Location<T = Record<string, unknown>> = { file: string | null; location: SourceArrayLocation[]; metadata?: T; }; export type CollectableInfos<T = Record<string, unknown>> = { file?: string | null; metadata?: T; location: SourceArrayLocation; }; export type CollectableSetData<T = Record<string, unknown>> = { type: Type; entries: Array<{ value: string; locations: Location<T>[]; }>; }; export interface CollectableSet<T = Record<string, unknown>> { add(value: string, infos: CollectableInfos<T>): void; toJSON(): CollectableSetData<T>; type: Type; values(): Iterable<string>; } export declare class DefaultCollectableSet<T = Record<string, unknown>> implements CollectableSet<T> { #private; type: Type; static mergeData<T>(set: CollectableSet<T>, data: CollectableSetData<T>): CollectableSet<T>; constructor(type: Type); add(value: string, { file, location, metadata }: CollectableInfos<T>): void; toJSON(): CollectableSetData<T>; static fromJSON<T>(data: CollectableSetData<T>): DefaultCollectableSet<T>; values(): Iterable<string>; [Symbol.iterator](): Generator<{ value: string; locations: Location<T>[]; }, void, unknown>; } //# sourceMappingURL=CollectableSet.d.ts.map