key-value-transformer

Scans and replaces key value pairs in a stream of lines

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
key-value-transformer
003.2.3a month ago2 years agoMinified + gzip package size for key-value-transformer in KB

Readme

npm License Typed with TypeScript bundlejs downloads GitHub Issues Build Status Styled with prettier Commitizen friendly Known Vulnerabilities Coverage Status
key-value-transformer
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" ];})
API

Table of Contents

*   [Parameters](#parameters)
*   [Properties](#properties)
*   [Parameters](#parameters-1)

KeyValueUpdates

Type: Function

Parameters


Returns AsyncIterable<Array<string>> updated key and value pairs

Lines

Type: Function

Returns Iterable<string>

KeyValueTransformOptions

Type: Object

Properties

  • extractKeyValue Function 1st. line with key and value
  • extractValueContinuation Function additional lines holding only values
  • lineEnding string used to separate lines
  • keyValueSeparator string chars to separate key from value like '=' or ':'
  • keyValueLines Function to generate line(s) for a key value(s) pair
  • trailingLines Lines? lines coming after all key values have been written
  • headLines Lines? lines before all key values have been written

colonSeparatedKeyValuePairOptions

Type: Object

equalSeparatedKeyValuePairOptions

Type: Object

colonSeparatedKeyValuePairOptionsDoublingKeys

Type: Object

keyValueTransformer

Replaces key value pairs in a stream of lines.

Parameters


Returns AsyncIterable<string> lines with replaces key value pairs
install
With npm
do:
npm install key-value-transformer
license
BSD-2-Clause