- Notifications
You must be signed in to change notification settings - Fork3
Module to convert Valve's KeyValue format to JSON and back
License
node-steam/vdf
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
VDF is a module to convertValve's KeyValue format to JSON and back using Typescript.
Heavily inspired bysimple-vdf
(
< v2.0.0
can be used as a drop-in replacement)
You can installVDF through the command line by using the following command:
yarn add @node-steam/vdf
import*asVDFfrom'@node-steam/vdf';// orimport{parse,stringify,}from'@node-steam/vdf';
Parse a VDF string into a JSON object
conststring=`"string" "string""false" "false""true" "true""number" "1234""float" "12.34""null" "null""undefined" "undefined""nested"{ "string" "string" "deep" { "string" "string" }}`;constobject=VDF.parse(string);// orconstobject=parse(string);>{string:'string',false:false,true:true,number:1234,float:12.34,null:null,undefined:undefined,nested:{string:'string',deep:{string:'string',},},};
Parse a JSON object into a VDF string
constobject={string:'string',false:false,true:true,number:1234,float:12.34,null:null,undefined:undefined,nested:{string:'string',deep:{string:'string',},},};conststring=VDF.stringify(object);// orconststring=stringify(object);>`"string" "string""false" "false""true" "true""number" "1234""float" "12.34""null" "null""undefined" "undefined""nested"{ "string" "string" "deep" { "string" "string" }}`;
Differences fromsimple-vdf
- Correct parsing of
booleans
,numbers
,null
andundefined
(>= v2.0.0
) - ES6 // Typescript syntax
- Typescript definitions
- Modern ES6 tests
- Silas Rech aka.lenovouser
Interested in contributing toVDF? Contributions are welcome, and are accepted via pull requests. Pleasereview these guidelines before submitting any pull requests.
Installing dependencies:
yarn
Compile:
yarn compile
Test:
yarn test
Generate Docs:
yarn docs
This module is thoroughly tested withava
About
Module to convert Valve's KeyValue format to JSON and back
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.