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: