0.0.4 • Published 3 years ago

simple-object-compressor v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Simple Object Compressor

Compresses JavaScript objects by shortening all keys by an abbreviation map.

const Compression = require('simple-object-compressor');

const compression = new Compression({
  testAttribute: 'ta',
  testValue: 'tv',
}, {
  maxDepth: -1,
});

compression.compact({ testAttribute: ['testValue'] });
// { ta: ['tv'] }

compression.expand({ ta: ['tv'] });
// { testAttribute: ['testValue'] }

Options

  • maxDepth {number} Default -1: Max depth to compress. Root of the object is 0. -1 is no limit. Arrays contents do not count as a depth increase.
{
  depth0: {
    depth1: ['depth1', { depth2: {} }],
  }
}
0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago