3.2.3 • Published 2 months ago

key-value-transformer v3.2.3

Weekly downloads
-
License
BSD-2-Clause
Repository
github
Last release
2 months ago

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](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)> updated key and value pairs

Lines

Type: Function

Returns Iterable[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/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](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) lines with replaces key value pairs

install

With npm do:

npm install key-value-transformer

license

BSD-2-Clause

3.2.3

2 months ago

3.2.2

3 months ago

3.2.1

3 months ago

3.2.0

3 months ago

3.1.1

12 months ago

3.1.0

1 year ago

3.0.4

1 year ago

3.0.5

1 year ago

3.0.3

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.3.0

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago