Repository navigation
identifiersPrefix option - #180
Conversation
india081947
left a comment
There was a problem hiding this comment.
I think you have incorporated all the required changes.
Please do check below points if it needs changes or not.
-
In Read me, I think you might not wanted to specify only mangled option. >> Use this option when
identifierNamesGenerator: 'mangled' -
I hope you dont want prefix track in this.previousMangledName = newName;
thanks
There was a problem hiding this comment.
Hi @sanex3339,
I may not be correct here, but just wanted to share my point here on why we need additional boolean type here.
As far as I know Chancejs will generate any random data, but will that anyway give 100% GUARANTEE that it wont repeat the same data as generated earlier? This just not apply to global but internal variable too.
If answer is NO then we are putting intentional BUG in system that in a time to come there may be a case that this.randomGenerator.getRandomString(3) & mangled variable (Hexa may have more less chances but not with mangled) gets generated same for another file and then the problem remains same...
We are introducing this field to GUARANTEE that no global variable will be repeat.
Instead I would suggest to introduce internal private static counter which will be a global counter and will get incremented on every new global / internal variable as prefixed, this counter if needed then converted to hexadecimal before affixing.
So in case of true, following code will generate global variable something XYZ_A, and then in some point for file number 1023 it can generate same XYZ_A, isn't that possible?
this.identifiersPrefix = this.options.identifiersPrefix === true ? this.randomGenerator.getRandomString(3)
: this.options.identifiersPrefix || '';
Above option with true will make person addicted to that options assuming he is safe on duplicate while there are small chance of repeat.
So from my side I would not suggest this code, instead the previous PR's simple logic would suffice solution.
1 similar comment
|
Now prefix will added only to global identifiers. Should add tests and some refactoring, because i don't like the way how Yep, i will add prefix generation on CLI side for directory obfuscation. |
|
Seems complete |
No description provided.