Skip to content

arlac77/key-value-transformer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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 Lines 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: KeyValueTransformOptions

equalSeparatedKeyValuePairOptions

Type: KeyValueTransformOptions

colonSeparatedKeyValuePairOptionsDoublingKeys

Type: KeyValueTransformOptions

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