node-properties icon indicating copy to clipboard operation
node-properties copied to clipboard

Make type casting configurable

Open tatablack opened this issue 11 years ago • 7 comments

I can see how the automatic casting of property values to JavaScript types might come in useful, but sometimes you really just want the literal value.

For my use case: I am reading a properties file containing mappings between file names and their SHA-1 hashes, truncated to 8 characters. Some of those hashes might look like numbers in exponential notation, say '90e02100', in which case having them cast to a Number is definitely not a good thing.

The same could be argued for numbers in octal or hex notation, I guess.

So, as per subject, I made this configurable, added the relevant tests and updated the Readme.

tatablack avatar Nov 02 '14 00:11 tatablack

Wow! Very good job. This was one of the things I had in mind.

gagle avatar Nov 02 '14 07:11 gagle

Thanks.. :wink: When I first noticed this, I scratched my head for quite some time, since what I saw was some of my file hashes turned into "Infinity"... :smile:

tatablack avatar Nov 02 '14 22:11 tatablack

If all is in order, may I encourage you to proceed with the merge? I've been pointing my package.json to my fork for a while, but I'd rather point to a published module.. :smile:

tatablack avatar Mar 24 '15 11:03 tatablack

I'm doing the v2.0.0, I'll include this feature.

gagle avatar Apr 07 '15 15:04 gagle

Hi @gagle, any plans to merge this PR?

eugef avatar Jul 06 '16 11:07 eugef

+1, this would really be useful (e.g when parsing a properties file that contains version numbers...)

jblievremont avatar Nov 18 '16 14:11 jblievremont

Any updates on this merge?

shrock-n-awe avatar Jun 26 '17 16:06 shrock-n-awe