0.2.1 • Published 4 years ago

feed-tunnel v0.2.1

Weekly downloads
53
License
ISC
Repository
github
Last release
4 years ago

Description

A lightweight library for compressing json data, by removing redundancy of name-value objects, and store only the values in an array.

Example usage

Define a schema in array format like this:

const schema = ["field1", "field2", "field3"];

And some data:

const feed = "[\"2020-07-07T09:55:38.920Z\",\"2020-05-07T11:19:22.179Z\",22]"

A reader:

const read = buildReader(schema)

Read the data:

const output = read(feed)

The output will look like this:

    {
        field1: "2020-07-07T09:55:38.920Z",
        field2: "2020-05-07T11:19:22.179Z",
        field3: 22
    }

Example of nested data

    const schema = ["field1", "field2", "field3", "objects", ["ofield1","ofield2"]];
    const feed = "[\"2020-07-07T09:55:38.920Z\",\"2020-05-07T11:19:22.179Z\",22,[[\"value1\",\"value2\"],[\"value3\",\"value4\"]]]"

Output:

    {
        field1: "2020-07-07T09:55:38.920Z",
        field2: "2020-05-07T11:19:22.179Z",
        field3: 22,
        objects: [
            {
                ofield1:"value1",
                ofield2:"value2",
            },
            {
                ofield1:"value3",
                ofield2:"value4",
            }
        ]
    }
0.2.1

4 years ago

0.2.0

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

1.0.0

4 years ago