1.0.0 • Published 6 years ago

compress-object v1.0.0

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

compress-object

💎 when objects become too large, let's turn them into something smaller

Npm Version Build Status Dependency Status devDependency Status Coverage Status npm npm

Installation

npm install compress-object --save

Usage

a AMD version of this is available at dist/compress-object.js

const Compress = require('compress-object');
const flattened = ['Gabriel J. Csapo', 22, 'Male', [], ['PayPal', 'Software Engineer']];
const compressor = new Compress({
    name: '',
    age: 0,
    gender: '',
    friends: [],
    job: {
        employer: '',
        position: ''
    }
});

const object = compressor.deserialize(flattened);
const flattenAgain = compressor.serialize(object);

What does it do?

compress-object aims to remove the need for keys in JSON, by having a map to and from the flattened structure

Turning an array of 1000 complex objects (objects that have nsted objects and nested arrays) (373ms)

size beforesize after
315.04 KB231.06 KB