import { NodeDefinition, NodeLike, StatelessGraphNode, StatelessNodeDefinition, StatelessNodeType } from '../../types/graph'; /** * An instance of the [[truncate]] node. * See the [[truncate]] documentation to find out more. */ export interface TruncateNode extends StatelessGraphNode<'truncate', TruncateNodeProperties> { } /** * A definition of the [[truncate]] node. * See the [[truncate]] documentation to find out more. */ export interface TruncateNodeDefinition extends StatelessNodeDefinition<'truncate', TruncateNodeProperties> { } export interface TruncateNodeProperties { length: NodeDefinition; omission: NodeDefinition | undefined; subject: NodeDefinition; } /** * The implementation of the [[truncate]] node. * See the [[truncate]] documentation to learn more. */ export declare const TruncateNodeType: StatelessNodeType<'truncate', TruncateNodeProperties>; /** * Creates a new instance of a [[truncate]] node, which is used for truncating a string to a given length. The node expects * the subject to be a [[value]] containing a string value. It works in the same way as * `truncate` from `lodash`. By default, the omission is configured to `...` but it can be changed. * * * @example **Truncate a string** * ```js * import muster, { truncate } from '@dws/muster'; * * const app = muster({}); * * await app.resolve(truncate('Hello world', 5)); * // === 'He...' * * await app.resolve(truncate('Hello world', 8)); * // === 'Hello...' * * await app.resolve(truncate('Hello world', 6, '+')); * // === 'Hello+' * * await app.resolve(truncate('Hello world', 8, '+')); * // === 'Hello w+' * ``` */ export declare function truncate(subject: NodeLike, length: NodeLike, omission?: NodeLike): TruncateNodeDefinition; export declare function isTruncateNodeDefinition(value: NodeDefinition): value is TruncateNodeDefinition;