Skip to content

Releases: UselessPickles/ts-enum-util

Removed peer dependency on TypeScript

06 Jun 02:25
Compare
Choose a tag to compare

The peer dependency on TypeScript was more trouble than it was worth. See #16

Non-positive-integer enum value bug fixes

25 Apr 02:25
Compare
Choose a tag to compare

This is a bug fix for numeric enums whose values are not all positive integers.

The code that gets all of the keys of an enum (ignoring the reverse lookup keys that typescript automatically adds) incorrectly assumed that all numeric enum values (and therefore the reverse lookup keys) would be limited valid array index values (basically, non-negative integers within the range of a signed 32-bit value).

This was a bad assumption. Numeric enums can contain any numeric values, including floating point and negative values. The end result was widespread bugs if you had a numeric enum values that was negative or not an integer.

New Value Visitor/Mapper Functionality

22 Mar 05:51
Compare
Choose a tag to compare

Huge New Feature!

The functionality of ts-string-visitor (npm, github) has been merged into ts-enum-util and improved to also support numeric literal/enum values. See the README for a link to full documentation of Value Visitor/Mapper functionality, and also a Migration Guide if you previously used ts-string-visitor.

This unfortunately brought with it a breaking change: TypeScript 2.9 is now the minimum supported version.

Other New Features

  • (possibly breaking) The iteration/sort order of enum entries/values/keys is no longer based on sorted key order. The original defined order of the enum is now retained (guaranteed in ES6 environments due to language spec, all but guaranteed in non-ES6 environments due to de-facto standards of nearly all implementations). This is more likely to give desired results if you use $enum().map() to create options for a dropdown UI component, for example.
  • New $enum().indexOfValue() to get the index of an enum entry based on a value. Can be useful for implementing sort comparators for grids, etc.
  • New $enum().indexOfKey() to get the index of an enum entry based on a key. Can be useful for implementing sort comparators for grids, etc.

@@toStringTag Implementation

26 Jun 04:40
Compare
Choose a tag to compare

The @@toStringTag symbol is now implemented on EnumWrapper

@@toStringTag Implementation

26 Jun 04:40
Compare
Choose a tag to compare

The @@toStringTag symbol is now implemented on EnumWrapper

Fix published NPM package

07 Jun 04:35
Compare
Choose a tag to compare

The publish NPM package for version 3.0.5 was missing files. This version is simply a re-build and re-publish of 3.0.5 to fix the NPM package.

Minor Type Definitions Fix

06 Jun 03:41
Compare
Choose a tag to compare

The convenience types NumberEnumWrapper, StringEnumWrapper and MixedEnumWrapper were incorrectly defined by using type any instead of type T.

This had no impact on typical usage of ts-enum-util.

Minor Type Definitions Fix

06 Jun 03:39
Compare
Choose a tag to compare

The convenience types NumberEnumWrapper, StringEnumWrapper and MixedEnumWrapper were incorrectly defined by using type any instead of type T.

This had no impact on typical usage of ts-enum-util.

Minor Code Simplification

03 Jun 03:52
Compare
Choose a tag to compare

Removed an unnecessary conditional in iterator code.

Minor Code Simplification

03 Jun 03:59
Compare
Choose a tag to compare

Removed an unnecessary conditional in iterator code.