compress-object

1.0.0 • Public • Published

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 before size after
315.04 KB 231.06 KB

Readme

Keywords

none

Package Sidebar

Install

npm i compress-object

Weekly Downloads

4

Version

1.0.0

License

ISC

Last publish

Collaborators

  • gabrielcsapo