import { Name } from './name.js'; import { Config } from './config.js'; import { Namefully, NameOptions } from './namefully.js'; type VoidCallback = () => void; type Callback = (value: Type) => Return; /** * A generic builder class that provides common functionality for building instances. */ declare abstract class Builder { protected readonly prebuild?: VoidCallback | undefined; protected readonly postbuild?: Callback | undefined; protected readonly preclear?: Callback | undefined; protected readonly postclear?: VoidCallback | undefined; protected queue: T[]; protected instance: I | null; constructor(prebuild?: VoidCallback | undefined, postbuild?: Callback | undefined, preclear?: Callback | undefined, postclear?: VoidCallback | undefined); /** Gets the current size of the builder. */ get size(): number; /** Removes and returns the first element of the queue. */ removeFirst(): T | undefined; /** Removes and returns the last element of the queue. */ removeLast(): T | undefined; /** Adds a value at the beginning of the queue. */ addFirst(value: T): void; /** Adds a value at the end of the queue. */ addLast(value: T): void; /** Adds a value at the end of the queue. */ add(...values: T[]): void; /** Removes a single instance of a value from the queue. */ remove(value: T): boolean; /** Removes all elements matched by the test function from the queue. */ removeWhere(callback: Callback): void; /** Removes all elements not matched by the test function from the queue. */ retainWhere(callback: Callback): void; /** Removes all elements in the queue. */ clear(): void; /** Builds the desired instance with optional parameters. */ abstract build(options?: Partial): I; } /** * An on-the-fly name builder. * * The builder uses a lazy-building method while capturing all necessary Names * to finally construct a complete Namefully instance. * * @example * ```js * const builder = NameBuilder.of([Name.first('Thomas'), Name.last('Edison')]); * builder.add(Name.middle('Alva')); * console.log(builder.build()); // 'Thomas Alva Edison' * ``` */ export declare class NameBuilder extends Builder { private constructor(); /** Creates a base builder from one Name to construct Namefully later. */ static create(name?: Name): NameBuilder; /** Creates a base builder from many Names to construct Namefully later. */ static of(...initialNames: Name[]): NameBuilder; /** Creates a base builder from many Names with lifecycle hooks. */ static use({ names, prebuild, postbuild, preclear, postclear, }: { names?: Name[]; prebuild?: VoidCallback; postbuild?: Callback; preclear?: Callback; postclear?: VoidCallback; }): NameBuilder; /** * Builds an instance of Namefully from the previously collected names. * * Regardless of how the names are added, both first and last names must exist * to complete a fine build. Otherwise, it throws a NameError. */ build(options?: NameOptions): Namefully; } export {};