Is anyone here opposed to maybe adding a more user-friendly API to this library.
Right now it takes a fair amount of boilerplate to do what is essentially JSON.parse(encoded) or JSON.stringify(obj).
Plus, there doesn't seem to be a way to get the same objects out on the decode end as were put into the encoding step. This means even more boilerplate code to translate certain fields from numbers into enum strings. Considering this is probably the most common use case it seems worth it to make this a simple one-step call like buffer = encode(schema, obj) and obj = decode(schema, buffer). And preferably, the input to encode and the output of decode should have deep equality.
Is anyone here opposed to maybe adding a more user-friendly API to this library.
Right now it takes a fair amount of boilerplate to do what is essentially
JSON.parse(encoded)orJSON.stringify(obj).Plus, there doesn't seem to be a way to get the same objects out on the decode end as were put into the encoding step. This means even more boilerplate code to translate certain fields from numbers into enum strings. Considering this is probably the most common use case it seems worth it to make this a simple one-step call like
buffer = encode(schema, obj)andobj = decode(schema, buffer). And preferably, the input to encode and the output of decode should have deep equality.