Closed danielwerg closed 3 years ago
I think the problem is the fact that you're not writing a JSON output to the file anymore, but you're still parsing it as JSON: you're currently writing with stringify-object
to the readme, but you're still parsing with JSON.parse
from the saved file
I can think of two solutions:
doc/methods
, everything could be in the readme.JSON.parse
. You can then compare this "JSON-able" version of the actual output with the object you parse from the files saved in doc/methods
Please note that while this is safer it also means that everything that's not "JSON-able" will be reduced to a string, and the changes won't be detected unless you switch back to a JSON type.stringify-object
, and the saved file with the JSON outputIf you ask me, it seems like all this work isn't worth returning a couple of dates: you can just return the string since that can be parsed back into a Date
object. You don't need to worry about timezones because if they're able to re-parse it back to a Date
they can also deal with their specific timezone as they would do with any other date.
methods.ts
script is broken after these two commits: https://github.com/danielwerg/r6api.js/commit/62ac72c37bcdff72f70ac695346f0e03a4db4a96#diff-8fa4b52909f895e8cda060d2035234e0a42ca2c7d3f8f8de1b35a056537bf199 https://github.com/danielwerg/r6api.js/commit/c0fdf5046a8befab0107a7e7e42f8b02e18f30af#diff-8fa4b52909f895e8cda060d2035234e0a42ca2c7d3f8f8de1b35a056537bf199structureChange
will always returntrue
because it's writingstring
to json but originally we haveobject
for season release date.https://github.com/danielwerg/r6api.js/blob/typescript/docs/methods/getRanks.json#L12 https://github.com/danielwerg/r6api.js/tree/typescript#getranks https://github.com/danielwerg/r6api.js/blob/typescript/src/constants.ts#L65
Solutions?
Return string instead of date object, but I'm not sure what's is a best practice for that because of timezones stuff.