sdf-parser
Version:
44 lines • 1.94 kB
TypeScript
import type { Molecule } from '../parse.ts';
/**
* Internal per-label tracking information used during parsing.
*/
export interface LabelInfo {
/** Number of molecules that contain this label. */
counter: number;
/**
* Whether all seen values for this label are numeric.
* Starts as `true` when `dynamicTyping` is enabled.
*/
isNumeric: boolean;
/** Whether this label is included in molecule output (not excluded). */
keep: boolean;
/** Minimum numeric value (set after all molecules are parsed). */
minValue?: number;
/** Maximum numeric value (set after all molecules are parsed). */
maxValue?: number;
/** Whether every molecule in the result contains this label. Set after parsing. */
always?: boolean;
/** Optional modifier function applied to the raw string value. */
modifier?: (value: string) => unknown;
/** Optional callback stored for this label (for statistics). */
forEach?: (value: unknown) => void;
}
/** Options consumed by {@link getMolecule} (a resolved subset of ParseOptions). */
export interface GetMoleculeOptions {
eol: string;
dynamicTyping: boolean;
include?: string[];
exclude?: string[];
modifiers: Record<string, (value: string) => unknown>;
forEach: Record<string, (value: unknown) => void>;
}
/**
* Parse a single SDF entry string into a molecule object.
* @param sdfPart - A single SDF record (everything before the `$$$$` line).
* @param labels - Shared label tracking object, mutated in place.
* @param currentLabels - Array to collect label names found in this entry.
* @param options - Resolved parse options.
* @returns The molecule object, or `undefined` if the entry is too short.
*/
export declare function getMolecule(sdfPart: string, labels: Record<string, LabelInfo>, currentLabels: string[], options: GetMoleculeOptions): Molecule | undefined;
//# sourceMappingURL=getMolecule.d.ts.map