Releases: chasefleming/enum-xyz
Releases · chasefleming/enum-xyz
Version 0.3.1
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
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
, anduppercase
. - Example:
Enum.String({ casing: 'snakeCase' })
.
- Available options:
- 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 })
.
- Example:
3. Symbol Enums with Global Option:
- Added the ability to create global symbols using the
global
option.- Example:
Enum.Symbol({ global: true })
.
- Example:
v0.2.0
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 theNumeric
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
- Adds Symbol enum option
v0.0.6
Bump version