GeezerVison is showing github.com — feat: add numbersToHexadecimal option to control number to hex conversion by jbetala7 · Pull Request #1319 · javascript-obfuscator/javascript-obfuscator
Conversation
jbetala7
commented
Aug 7, 2025
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
🎯 Purpose
Resolves #1317 - Adds option to prevent automatic conversion of numbers to hexadecimal format.
📋 Changes
- ✅ Added
numbersToHexadecimal boolean option (default: true)
- ✅ Updated
NumberLiteralTransformer to respect the new option
- ✅ Added CLI support with
--numbers-to-hexadecimal flag
- ✅ Updated all configuration presets and interfaces
- ✅ Added comprehensive test coverage
- ✅ Updated README documentation with examples
🔄 Behavior
- Default (
true): Maintains existing behavior (backward compatible)
- New (
false): Keeps numbers in decimal format
🧪 Testing
Added test cases covering both scenarios:
- ✅
numbersToHexadecimal: true converts to hex
- ✅
numbersToHexadecimal: false preserves decimal
📚 Documentation
- Updated README with option description and examples
- Added CLI option documentation
- Updated default options section
🔧 Usage Examples
// JavaScript API
JavaScriptObfuscator.obfuscate(code, {
numbersToHexadecimal: false
});
// CLI
javascript-obfuscator input.js --numbers-to-hexadecimal false
This solution will help not just @acemtp, but any other users who prefer to keep their numbers in decimal format for readability or specific requirements!
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Please remove package-lock.json and yarn.lock files from this PR, and i will merge it
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Both package-lock.json and yarn.lock files have been deleted
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
jbetala7
changed the title
feat: add numbersToHexadecimal option to control number to hex conver…
feat: add numbersToHexadecimal option to control number to hex conversion
Nov 30, 2025
|
I still see yarn.lock conflict
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…sion
- Add new numbersToHexadecimal option (default: true) to control whether numbers are converted to hexadecimal format
- When true, numbers like 1000 are converted to 0x3e8
- When false, numbers remain in their original decimal format
- Update CLI interface to support --numbers-to-hexadecimal flag
- Add comprehensive documentation with examples
- Update all relevant presets and tests
- Fixes issue where users couldn't disable number to hex conversion
|
Rebased on current master and removed the lockfile changes from the PR diff. The PR now only includes the feature/docs/test files; package-lock.json and yarn.lock are no longer modified.
Verification:
- corepack yarn run test:mocha -- --grep numbersToHexadecimal
- git diff --check upstream/master...HEAD
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.