Skip to content

v2.0.0

Choose a tag to compare

@macarie macarie released this 08 Mar 22:34
· 28 commits to master since this release

I'm happy to introduce compatto v2 ๐Ÿง

While developing v2 all the focus was on improving performance and reducing the bundle size, but this also led to a breaking API change, hence the major version release ๐ŸŽˆ

If the focus was on performance, what did change?

Well, now compress() internally converts the dictionary in a trie, or something close to it. This is a lot faster than the old method used!

How much faster? Approximately 30% faster!

Do you want to know more about performance? Check out the Performance section of the readme ๐Ÿฆฆ

Reducing bundle size you say?

Yes, now the dictionary has to be explicitly set by users, like that:

import { dictionary } from 'compatto/dictionary'
import { compatto } from 'compatto'

const { compress, decompress } = compatto({ dictionary })

This helps to reduce the bundle size for people that don't use the default dictionary.

Also moving away from the class implementation helped, now the code can be minified better, like almost 2 times better ๐Ÿ‘€

I think that that is a breaking change, are there others?

As you've seen in the example code above, now the compatto import is a function and not an object anymore. To use compress() and decompress() you have to call it, you can then use these functions through the returned object of compatto().

A quick way to update without having to mess up the existing code is:

import { dictionary } from 'compatto/dictionary'
import { compatto as c } from 'compatto'

const compatto = c({ dictionary })

Another breaking change is the removal of create(), now compatto() itself is create().

You can explore v2's API in its section of the readme ๐Ÿฆฆ

Other changes

  • The readme has been updated, I hope it is clearer now ๐Ÿ˜Š
  • Typings and in-code docs updated as well ๐Ÿงƒ
  • More tests that should help prevent implementation errors ๐Ÿ™Œ๐Ÿผ

See v1.0.0...v2.0.0 for all changes.

That's all for now, see ya ๐Ÿ––๐Ÿผ