Never Pay your Mortgage

    jsoncram

    2.0.3 • Public • Published

    jsoncram

    Crams json into a smaller footprint and unpacks it.

    GitHub license GitHub issues Twitter

    Install

    npm i -D jsoncram

    Usage

    const { compress, decompress } = require('jsoncram');
     
    const json = {
        name: 'Sem Postma',
        age: 21
    };
     
    const schema = {
        type: "object",
        required: [
            "name",
            "age"
        ],
        properties: {
            name: {
                type: "string"
            },
            age: {
                type: "number"
            }
        }
    };
     
    const compressed = compress(json, schema);
    const decompressed = decompress(compressed, schema);
     
    if (
        json.name === decompressed.name
        && json.age === decompressed.age
    ) {
        console.log('Yeeeeey');
    }
     

    Install

    npm i jsoncram

    DownloadsWeekly Downloads

    5

    Version

    2.0.3

    License

    MIT

    Unpacked Size

    28.3 kB

    Total Files

    20

    Last publish

    Collaborators

    • afirus