Skip to content

Releases: UselessPickles/ts-enum-util

Declaration Source Maps

02 Jun 14:59
Compare
Choose a tag to compare

Source maps are now generated and distributed for the TypeScript declaration files.

Reverting "fix" to source maps

01 Jun 02:39
Compare
Choose a tag to compare

Nothing was actually wrong with the source maps in 3.0.0. My "fix" in 3.0.1 actually broke it. I'm dumb. This release reverts back to 3.0.0.

Source Map Fix

01 Jun 02:07
Compare
Choose a tag to compare

The distributed source maps had incorrect paths to the source. this is now fixed.

Now Supporting TypeScript 2.9!

01 Jun 02:06
Compare
Choose a tag to compare

Source code and distributed type definitions are now compatible with TypeScript 2.9.

Unfortunately, in order to support TypeScript 2.9, I had to drop support for TypeScript versions prior to 2.8.

Use ts-enum-util v2 if you require compatibility with older TypeScript versions.

Update TypeScript Compatibility Info

01 Jun 00:48
Compare
Choose a tag to compare

This is a minor documentation and NPM peer dependency updated.

TypeScript 2.9 introduced a breaking change to the keyof operator that impacts this project. ts-enum-util is currently only compatible with TyoeScript 2.3 - 2.8.

Stay tuned for version 3.0 of ts-enum-util, which should be compatible with TypeScript 2.8+. Unfortunately, there's no way for me to specify the types of this project that is both compatible with TypeScript 2.9 and backwards compatible with versions earlier than 2.8.

Now More Immutable!

10 Mar 05:51
Compare
Choose a tag to compare
  • Use Object.freeze() to make data immutable at run time.
  • Simplify some code because defensive copies are no longer necessary.
  • Add several new unit tests and tslint tests to verify immutability (both compile-time and run-time).

Documentation and Peer Dependency Updates

07 Mar 06:47
Compare
Choose a tag to compare

No functional changes. Just behind-the-scenes testing updates that lead to updated documentation and peer dependency info.

  • Added dtslint tests to verify compile-time types.
  • Verified compatibility with TypeScript 2.3+.
  • Minor code style and code comments cleanup.

Improved Caching Performance

24 Feb 05:03
Compare
Choose a tag to compare

Improvements

  • A WeakMap is now instead of a Map to cache EnumWrapper instances. This ensures that EnumWrapper instances are garbage collected whenever their corresponding "enum-like" objects are garbage collected (no memory leaks). This should also improve cache set/get performance because WeakMap implementations can feature O(1) constant time set/get.
  • The $enum() function was also optimized by making it a direct alias/reference to EnumWrapper.getCachedInstance().

Breaking Changes

Because WeakMap solves the concern about memory leaks when ts-enum-util is used on temporary enum-like objects, there's really no need to opt out of caching any more. Accordingly, the following API changes were made:

  • Removed EnumWrapper.createUncachedInstance()
  • Removed optional useCache param to the $enum() function (it now always uses the cache).

It's DONE! (for now)

21 Feb 23:27
Compare
Choose a tag to compare
  • Optimization: Avoid double key lookups into a map for successful value->key reverse lookups.
  • Additional code documentation about some of the optimizations.
  • Added unit tests to ensure that key/value names matching Object.prototype properties do not cause false positives.

Optimizations

21 Feb 07:20
Compare
Choose a tag to compare

Some code optimizations:

  • Several methods updated to use raw for() loops instead of Array.prototype.forEach and Array.prototype.map.
  • Changed "isKey()" method to use Object.hasOwnProperty() on the original enum object instead of relying on a ES6 Set of keys.
  • Use Array.prototype.slice to return defensive copies of lists of keys and values (instead of mapping from list of entries)
  • Keys are now stored as a plain array instead of an ES6 Set.