Skip to content

Releases: chasefleming/enum-xyz

Version 0.3.1

23 Aug 00:06
cb70a38
Compare
Choose a tag to compare

Bug Fixes

  • Casing Styles Missing - Fixed an oversight where lowercase and uppercase casing styles were mentioned in the documentation but were missing in the actual implementation. You can now use both lowercase and uppercase as valid casing styles for String Enums.

Usage

const { HELLO, WORLD } = Enum.String({ casing: 'lowercase' });
console.log(HELLO); // Outputs: "hello"

const { hello, world } = Enum.String({ casing: 'uppercase' });
console.log(hello); // Outputs: "HELLO"
  • Build Issue Resolved - Addressed a problem that was causing build failures. This issue might have prevented some users from installing or building the library correctly. It's now resolved, and the library should build as expected.

Version 0.3.0

18 Aug 15:20
1593db4
Compare
Choose a tag to compare

New Features:

1. String Enums with Enhanced Options:

  • Introduced the ability to transform string enum values based on specified casing styles.
    • Available options: snakeCase, camelCase, PascalCase, kebabCase, lowercase, and uppercase.
    • Example: Enum.String({ casing: 'snakeCase' }).
  • Added transform option for custom transformations of enum values.
    • Example: Transforming enum values into API endpoints:
const options = {
  casing: 'kebabCase',
  transform: (value) => `https://api.example.com/${value}`
};
const { userEndpoint } = Enum.String(options);
console.log(userEndpoint); // Outputs: "https://api.example.com/user-endpoint"

2. Enhanced Numeric Enums:

  • Added startIndex option to start the numeric enum from a specific index.
  • Introduced a step option to increment numeric values by a specific step (e.g., 2, 5, 10).
    • Example: Enum.Numeric({ startIndex: 5, step: 2 }).

3. Symbol Enums with Global Option:

  • Added the ability to create global symbols using the global option.
    • Example: Enum.Symbol({ global: true }).

v0.2.0

17 Aug 03:03
Compare
Choose a tag to compare

New Features:

  • Introduced a unified Numeric function that allows users to specify a starting index. This provides more flexibility and reduces the need for multiple functions.
const { A, B, C, D } = Enum.Numeric(5); // Starts from 5

Deprecations:

  • NumericAt has been deprecated. Users are encouraged to use the Numeric function and provide a starting index if needed. This change simplifies the API and provides a more consistent experience.
  • StringLower has been deprecated. Future releases will introduce a more flexible approach for string transformations.

Enhancements:

  • Updated documentation to reflect the latest changes and provide clearer examples.

Fixes:

  • Fixed issue where numeric enums did not reset their index on separate declarations

v0.1.0

22 Apr 00:27
3a4dc01
Compare
Choose a tag to compare
  • Adds Symbol enum option

v0.0.6

18 Mar 00:12
Compare
Choose a tag to compare
Bump version