/** * Replaces key value pairs in a stream of lines. * @param {AsyncIterable} source input as lines * @param {KeyValueUpdates} updates * @param {KeyValueTransformOptions} options * @return {AsyncIterable} lines with replaces key value pairs */ export function keyValueTransformer(source: AsyncIterable, updates: KeyValueUpdates, options?: KeyValueTransformOptions): AsyncIterable; export function stringsToLines(source: any): AsyncGenerator; export function Uint8ArraysToLines(source: any, decoder?: TextDecoder): AsyncGenerator; /** * @typedef {Function} KeyValueUpdates * * The last call to KeyValueUpdates will be with an undefined key to provide required 'default' key value pairs. * * @param {string} key current key * @param {string} value current value * @param {Set} presentKeys the already seen keys * @return {AsyncIterable} updated key and value pairs */ /** * @typedef {Function} Lines * @return {Iterable} */ /** * @typedef {Object} KeyValueTransformOptions * @property {Function} extractKeyValue 1st. line with key and value * @property {Function} extractValueContinuation additional lines holding only values * @property {string} lineEnding used to separate lines * @property {string} keyValueSeparator chars to separate key from value like '=' or ':' * @property {Lines} keyValueLines to generate line(s) for a key value(s) pair * @property {Lines} [trailingLines] lines coming after all key values have been written * @property {Lines} [headLines] lines before all key values have been written */ /** * @type {KeyValueTransformOptions} * Options to describe key value pair separated by a colon ':' */ export const colonSeparatedKeyValuePairOptions: KeyValueTransformOptions; /** * @type {KeyValueTransformOptions} * Options to describe key value pair separated by an equal sign '=' */ export const equalSeparatedKeyValuePairOptions: KeyValueTransformOptions; /** * @type {KeyValueTransformOptions} * Options to describe key value pair separated by a colon ':' */ export const colonSeparatedKeyValuePairOptionsDoublingKeys: KeyValueTransformOptions; /** * The last call to KeyValueUpdates will be with an undefined key to provide required 'default' key value pairs. */ export type KeyValueUpdates = Function; export type Lines = Function; export type KeyValueTransformOptions = { /** * 1st. line with key and value */ extractKeyValue: Function; /** * additional lines holding only values */ extractValueContinuation: Function; /** * used to separate lines */ lineEnding: string; /** * chars to separate key from value like '=' or ':' */ keyValueSeparator: string; /** * to generate line(s) for a key value(s) pair */ keyValueLines: Lines; /** * lines coming after all key values have been written */ trailingLines?: Function | undefined; /** * lines before all key values have been written */ headLines?: Function | undefined; };