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

Is there a way to not auto translate hex values?

Open JoachimR opened this issue 9 years ago • 4 comments

my config file:

bla=bla
HEX_ARRAY_1=0x34,0x38,0x99
HEX_ARRAY_2=0x31

properties parse result:

{ bla: 'bla', 
  HEX_ARRAY_1: '0x34,0x38,0x99',
  HEX_ARRAY_2: 49 }

The one value in HEX_ARRAY_2 is translated to decimal directly.

Is there a way to not do that ?

JoachimR avatar May 06 '15 14:05 JoachimR

By default, property values will be cast to their JavaScript type equivalent. You can use tatablack's fix to disable number type cast: https://github.com/gagle/node-properties/pull/12

shaochuancs avatar May 14 '15 08:05 shaochuancs

@shaochuancs i can't understand how to use tatablack's fix..

aleclofabbro avatar Jun 29 '15 15:06 aleclofabbro

@aleclofabbro The easiest way to use his fix is directly clone from his forked repository: https://github.com/tatablack/node-properties/tree/make-casting-optional

shaochuancs avatar Jun 30 '15 02:06 shaochuancs

:+1: Thx!

aleclofabbro avatar Jun 30 '15 08:06 aleclofabbro