import { type FactoryWithInput, type Factory, type FactoryWithRequiredInput } from '../getter'; import { type Maybe } from '../value'; import { type TransformStringFunctionConfig } from './transform'; /** * A factory that produces a string value with no input. */ export type StringFactory = Factory; /** * Converts a value of type T to a string. */ export type ToStringFunction = FactoryWithRequiredInput; /** * Wraps an existing factory with a {@link ToStringFunction} to produce strings from the factory's output. * * @param factory - The original value factory. * @param toStringFunction - Function to convert the factory's output to a string. * @returns A new factory that produces string values. * * @dbxUtil * @dbxUtilCategory string * @dbxUtilKind factory * @dbxUtilTags string, factory, wrap, transform, to-string * @dbxUtilRelated string-from-date-factory, string-from-time-factory * * @__NO_SIDE_EFFECTS__ */ export declare function stringFactoryFromFactory(factory: Factory, toStringFunction: ToStringFunction): StringFactory; /** * A factory that returns a string based on the input date. */ export type StringFromDateFactory = FactoryWithInput>; /** * Configuration for creating a {@link StringFromDateFactory}. */ export interface StringFromDateConfig { /** * The number of digits to return from the end of the generated string. * * Is ignored if transformStringConfig.slice is set, or the value is 0. */ readonly takeFromEnd?: number; /** * Optional/additional transformations to apply to the string. */ readonly transformStringConfig?: Maybe; /** * The factory function to generate the initial string from the input date. */ readonly dateToString: FactoryWithRequiredInput; } /** * Creates a factory that returns a string based on the input date. * * @param config - Configuration for the factory. * @returns A factory that returns a string based on the input date. * * @dbxUtil * @dbxUtilCategory string * @dbxUtilKind factory * @dbxUtilTags string, date, factory, transform, slice * @dbxUtilRelated string-from-time-factory, string-factory-from-factory, transform-string-function * * @__NO_SIDE_EFFECTS__ */ export declare function stringFromDateFactory(config: StringFromDateConfig): StringFromDateFactory; /** * Creates a factory that returns a string based on the Unix timestamp of the input date. * * @param digitsFromEnd - The number of digits to return from the end of the generated string. Defaults to 7. * @returns A StringFromDateFactory. * * @dbxUtil * @dbxUtilCategory string * @dbxUtilKind factory * @dbxUtilTags string, date, time, timestamp, factory, suffix * @dbxUtilRelated string-from-date-factory * * @__NO_SIDE_EFFECTS__ */ export declare function stringFromTimeFactory(digitsFromEnd?: number): StringFromDateFactory;