Skip to content

Version 0.3.0

Compare
Choose a tag to compare
@chasefleming chasefleming released this 18 Aug 15:20
· 3 commits to main since this release
1593db4

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 }).