1.0.0 • Published 6 years ago
compress-object v1.0.0
compress-object
💎 when objects become too large, let's turn them into something smaller
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 |