reqlite
reqlite copied to clipboard
Implement a matching JSON.stringify
Errors sent back by RethinkDB can contain a JSON value.
JSON.stringify(..., null, 4) doesn't quite match their syntax. Their typically use tabs instead of spaces.
If we have a matching JSON.stringify method, we can simplify some tests (those the error on a colon).
Is that something we could potentially "borrow" from their codebase?
Well, it's not something in the driver, their server send the JSON strings, so I guess cJSON (or whatever they replaced it with) output this JSON strings with tab. So we can't just copy paste code.
Their license is also not compatible with MIT I think - though I don't know how these thing really work...
Ah, well that's unfortunate.
Can you paste some example error objects in here and how they are being stringified? Or give instructions on how to reproduce? I could maybe take a look at this.
If you remove the lines like these in the tests: https://github.com/neumino/reqlite/blob/a09e61f96d23e62d2ef12efd25ef995caccbdf4e/test/selecting-data.js#L161
You will see failures and the output of JSON.stringify to reproduce
@neumino if you just need to use tabs instead of spaces, JSON.stringify(..., null, '\t') should work.
Thanks @marshall007. There are a few more things that a different. There are a few or missing new lines sometimes too (typically from what I remember RethinkDB doens't add a new line in an array.