dottle

0.1.5 • Public • Published

Dottle

AWS State Language to Graphviz DOT language

API

read(input, [options]) ⇒ AsyncIterator

Accepts a ReadableStream, an AsyncIterator, an array or a string and returns an AsyncIterator.

Kind: global function
Returns: AsyncIterator - Returns an AsyncIterator which yields Promises which resolve to parsed data.

Param Type Description
input ReadableStream | AsyncIterator | Array | string Raw input data
[options] Object Optional options object.

Example

for await (const result of read('{ "StartAt": "a", "States": { "a": { "Type": "Pass", "Next": "b" }, "b": { "Type": "Pass", "End": true } } }')) {
    console.log(result);
}
// => digraph { a -> b }

readToStream(input, [options]) ⇒ WritableStream

Accepts a ReadableStream, an array or a string and returns a WritableStream. Stream output will be utf-8 text. Stream values will be delimited by a system-native newline escape character.

Kind: global function
Returns: WritableStream - Returns a WritableStream Stream output will be utf-8 text. Stream values will be delimited by a system-native newline escape character.

Param Type Description
input ReadableStream | AsyncIterator | Array | string Raw input data
[options] Object Optional options object.

Example

readToStream('{ "StartAt": "a", "States": { "a": { "Type": "Pass", "Next": "b" }, "b": { "Type": "Pass", "End": true } } }').pipe(process.stdout);
// => digraph { a -> b }

readOne(input, [options]) ⇒ Promise

Accepts a ReadableStream, an AsyncIterator, an array or a string and returns a Promise which resolves to the first value of the stream.

Kind: global function
Returns: Promise - Returns a Promise which resolves to the first value of the stream.

Param Type Description
input ReadableStream | AsyncIterator | Array | string Raw input data
[options] Object Optional options object.

Example

console.log(await readOne('{ "StartAt": "a", "States": { "a": { "Type": "Pass", "Next": "b" }, "b": { "Type": "Pass", "End": true } } }'));
// => digraph { a -> b }

readAll(input, [options]) ⇒ Promise

Accepts a ReadableStream, an AsyncIterator, an array or a string and returns a Promise which resolves to an array of all values.

Note: If a stream or iterator is passed to readAll and it does not complete, the Promise returned by this function will never resolve.

Kind: global function
Returns: Promise - Returns a Promise which resolves to an array of all values.

Param Type Description
input ReadableStream | AsyncIterator | Array | string Raw input data
[options] Object Optional options object.

Example

console.log(await readAll('{ "StartAt": "a", "States": { "a": { "Type": "Pass", "Next": "b" }, "b": { "Type": "Pass", "End": true } } }'));
// => digraph { a -> b }

License

MIT

Package Sidebar

Install

npm i dottle

Weekly Downloads

7

Version

0.1.5

License

MIT

Unpacked Size

24.3 kB

Total Files

19

Last publish

Collaborators

  • machellerogden