Started writing documentation and adding examples

This commit is contained in:
Leon Mika 2023-04-24 06:09:22 +00:00
parent 7adb09d4db
commit 405bf812ee
5 changed files with 40 additions and 0 deletions

View file

@ -5,6 +5,9 @@ import (
"io"
)
// ToJSON is a filter function which converts each line from the source to a JSON structure.
// The result is a line-terminated list of JSON objects.
// The passed in function is to return a Go value that can be marshalled to JSON value.
func ToJSON(fn func(line string) any) func(r io.Reader, w io.Writer) error {
return func(r io.Reader, w io.Writer) error {
return eachLine(r, func(line string) (err error) {