Closed fengmk2 closed 1 year ago
+1
Good idea, I'll test and merge next week.
Cool, finally
This would actually be a problem for me since I am assuming they will (as they are already in the current version of the package) converted to String no matter what. Would it be possible to make this backwards compatible by enabling conversion to Number only by enabling some kind of option?
require('protobuf').uint64ToNumber = true
kinda thing?
agree @imkira . I think uint64ToNumber
flas is necessary, and by default protobuf
should return String. Otherwise its behavior is inconsistency
I'll not merge this, as it will break code for others.
We need a well-thought-out system for letting the module user decide how they want uint64s, enums and other types represented.
I do not have time to do this at the moment.
How about add the options like @imkira says 'uint64ToNumber = true' ?
@fengmk2 We need at least:
uint64ToNumber = true sint64ToNumber = true enumToNumber = true
Should these be at the module level, per-schema or per-parse?
module level will be good 2014-5-7 下午5:25于 "Chris Dew" notifications@github.com写道:
@fengmk2 https://github.com/fengmk2 We need at least:
uint64ToNumber = true sint64ToNumber = true enumToNumber = true
Should these be at the module level, per-schema or per-parse?
— Reply to this email directly or view it on GitHubhttps://github.com/chrisdew/protobuf/pull/35#issuecomment-42406251 .
In 90% cases, the (u)int64 numbers are small integer. I think we should use Number to present them when they are safe in Javascript.