GitHub - node-steam/vdf: Module to convert Valve's KeyValue format to JSON and back (original) (raw)
VDF is a module to convert Valve's KeyValue format to JSON and back using Typescript.
Heavily inspired by simple-vdf
(
< v2.0.0can be used as a drop-in replacement)
Installation
You can install VDF through the command line by using the following command:
Usage:
import * as VDF from '@node-steam/vdf';
// or
import { parse, stringify, } from '@node-steam/vdf';
Documentation:
VDF.parse(text: string)
Parse a VDF string into a JSON object
const string = "string" "string" "false" "false" "true" "true" "number" "1234" "float" "12.34" "null" "null" "undefined" "undefined" "nested" { "string" "string" "deep" { "string" "string" } };
const object = VDF.parse(string);
// or
const object = parse(string);
{ string: 'string', false: false, true: true, number: 1234, float: 12.34, null: null, undefined: undefined, nested: { string: 'string', deep: { string: 'string', }, }, };
VDF.stringify(object: object)
Parse a JSON object into a VDF string
const object = { string: 'string', false: false, true: true, number: 1234, float: 12.34, null: null, undefined: undefined, nested: { string: 'string', deep: { string: 'string', }, }, };
const string = VDF.stringify(object);
// or
const string = stringify(object);
"string" "string" "false" "false" "true" "true" "number" "1234" "float" "12.34" "null" "null" "undefined" "undefined" "nested" { "string" "string" "deep" { "string" "string" } };
Differences from simple-vdf
- Correct parsing of booleans, numbers, null and undefined (
>= v2.0.0) - ES6 // Typescript syntax
- Typescript definitions
- Modern ES6 tests
Contributors
- Silas Rech aka. lenovouser
Contributing:
Interested in contributing to VDF? Contributions are welcome, and are accepted via pull requests. Please review these guidelines before submitting any pull requests.
Help:
Installing dependencies:
Compile:
Test:
Generate Docs:
Tests:
This module is thoroughly tested with ava
