Scans and replaces key value pairs in a stream of lines
import { keyValueTransformer } from "key-value-transformer";
const input = getTextStream();
const output = keyValueTransformer(input, async * (key,value) => { yield [key, "newValue" ];})
- KeyValueUpdates
- Lines
- KeyValueTransformOptions
- colonSeparatedKeyValuePairOptions
- equalSeparatedKeyValuePairOptions
- colonSeparatedKeyValuePairOptionsDoublingKeys
- keyValueTransformer
Type: Function
Returns AsyncIterable<Array<string>> updated key and value pairs
Type: Function
Returns Iterable<string>
Type: Object
extractKeyValue
Function 1st. line with key and valueextractValueContinuation
Function additional lines holding only valueslineEnding
string used to separate lineskeyValueSeparator
string chars to separate key from value like '=' or ':'keyValueLines
Lines to generate line(s) for a key value(s) pairtrailingLines
Lines? lines coming after all key values have been writtenheadLines
Lines? lines before all key values have been written
Type: KeyValueTransformOptions
Type: KeyValueTransformOptions
Type: KeyValueTransformOptions
Replaces key value pairs in a stream of lines.
source
AsyncIterable<string> input linesupdates
KeyValueUpdatesoptions
KeyValueTransformOptions (optional, defaultcolonSeparatedKeyValuePairOptions
)
Returns AsyncIterable<string> lines with replaces key value pairs
With npm do:
npm install key-value-transformer
BSD-2-Clause