import type { AtomType } from "./atom"; export type MoleculeAtom = AtomType; export type MoleculePredicate = (atom: MoleculeAtom) => boolean; export type MoleculeVisitor = (atom: MoleculeAtom) => void; /** * Singleton helpers for running predicates / visitors over every atom inside * a nested “molecule” (plain object/array that may mix atoms, data, and methods). * * @example * ```ts * const t = { * name: atom(0), * a: "sldkjf", * somefn() {}, * test: { email: atom("") }, * }; * * molecule.every(t, (a) => a() !== null); * molecule.some(t, (a) => a() === 0); * molecule.each(t, (a) => a.set(a())); * ``` */ export declare const molecule: { /** * Like `Array.prototype.every`: returns `true` iff `predicate` is true for * every atom found. Short-circuits on the first `false`. */ readonly every: (root: unknown, predicate: MoleculePredicate) => boolean; /** * Like `Array.prototype.some`: returns `true` if `predicate` is true for * any atom. Short-circuits on the first `true`. */ readonly some: (root: unknown, predicate: MoleculePredicate) => boolean; /** * Run `visitor` on every atom. Returns nothing. */ readonly each: (root: unknown, visitor: MoleculeVisitor) => void; }; export type Molecule = typeof molecule; //# sourceMappingURL=molecule.d.ts.map