Monday 18 September 2017

vdfplus - A parser for Valve's KeyValue format

There are already some parsers that handle VDF to JSON (and back), but they don't feel "good enough" for me. For example duplicate keys are simply overwritten and data types are ignored.Duplicate keys are actually pretty common in .vdf files, e.g. Dota 2 or most of Steam Controller configs. vdfplus also tries to cast the values in to their respective data type, so numbers are actual numbers and not strings, which makes working with the resulting object inside JavaScript more sane. Additionally vdfplus handles characters like {, }, "inside quoted tokens properly, if they are escaped. And finally I also added a command-line interface, which allows for easy conversion from and to vdf with custom formatting or a sensible default formatting.npm:http://ift.tt/2ftAZvz had quite a bit of fun working on this. The API is inspired by the JSON.parse and JSON.stringify methods. and I also tried to translate the specification to VDF.stringify.Working on vdfplus made me tackle some new topics for me:TypeScriptPackage with CLITAP style tests, only worked with mocha+chai beforebrowserify and uglify to enable browser support for the packageFuture:Maybe add support for unquoted keys and values, which according to the developer wiki are valid.Maybe try to restore comments when going from VDF -> JSON -> VDFFeedback on basically everything is appreciated.

Submitted September 18, 2017 at 07:07AM by RoyalBingBong

No comments:

Post a Comment