{"id":22381726,"url":"https://github.com/koerismo/js-fast-vdf","last_synced_at":"2025-07-31T02:32:55.757Z","repository":{"id":129963660,"uuid":"587144086","full_name":"koerismo/js-fast-vdf","owner":"koerismo","description":"Your average javascript KeyValues processing library, as fast as parsable!","archived":false,"fork":false,"pushed_at":"2024-09-25T23:12:21.000Z","size":123,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-16T07:05:32.598Z","etag":null,"topics":["keyvalues","valve","vdf"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/koerismo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-10T03:56:49.000Z","updated_at":"2024-09-25T23:12:20.000Z","dependencies_parsed_at":"2024-08-22T22:24:55.391Z","dependency_job_id":"9d9933aa-b680-44b9-8eb0-f1cb9516c0eb","html_url":"https://github.com/koerismo/js-fast-vdf","commit_stats":{"total_commits":57,"total_committers":3,"mean_commits":19.0,"dds":"0.052631578947368474","last_synced_commit":"6e632b046f7d95ed725afda1b58e9b5cb2af6492"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koerismo%2Fjs-fast-vdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koerismo%2Fjs-fast-vdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koerismo%2Fjs-fast-vdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koerismo%2Fjs-fast-vdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koerismo","download_url":"https://codeload.github.com/koerismo/js-fast-vdf/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228209960,"owners_count":17885595,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["keyvalues","valve","vdf"],"created_at":"2024-12-05T00:10:03.173Z","updated_at":"2024-12-05T00:10:03.733Z","avatar_url":"https://github.com/koerismo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fast-vdf\nYour average javascript KeyValues processing library, as fast as parsable!\n\n# Installation\n```\nnpm i fast-vdf\n```\n\n# Usage\n```ts\nimport { vdf, KeyV, KeyVSet } from 'fast-vdf';\n\nconst root = vdf.parse(`\nSteamAppId      620\nSearchPaths\n{\n    Game        |gameinfo_path|.\n    Game        portal2_dlc2\n}\n`);\n\nconsole.log(root.value('SteamAppId'));\n// 620\n\nconsole.log(root.dir('SearchPaths').pair('Game').value);\n// \"portal2_dlc2\"\n\ntry { root.pair('DoesntExist'); }\ncatch(e) { console.warn(e.message) }\n// Pair with key \"doesntexist\" does not exist in set!\n\n// Strict behaviour is enabled by default with all KeyVSet methods.\n// Since this pair does not exist, this call throws an error.\n\nconsole.log(root.pair('DoesntExist', null));\n\n// The default value can be set to null to\n// disable this behaviour, instead returning null.\n\n\nroot.dir('SearchPaths').factory()\n    .pair('Game', 'portal2_dlc1')\n    .pair('Game', 'portal2')\n    .pair('Game', 'platform')\n    .exit();\n\n// Factory objects can be used to quickly create keyvalue structures.\n// The above code is equivalent to the below:\n\nconst sp = root.dir('SearchPaths');\nsp.add(new KeyV('Game', 'portal2_dlc1'));\nsp.add(new KeyV('Game', 'portal2'));\nsp.add(new KeyV('Game', 'platform'));\n\n\n// After you've created your structure, you can dump it as a formatted\n// string with the dump function.\n\nroot.dump({\n    quote: 'auto',\n    escapes: false\n});\n```\n\n\n# API\n\n## Breaking Changes\n\n### 2.0.0\n- The `types` and `multiline` options now default to false.\n- The `auto` quoting mode has been split into `auto` and `auto-typed`.\n\t- `auto` behaves normally, quoting only values which strictly need to be quoted.\n\t- `auto-typed` allows fast-vdf to quote string values that might be confused with non-string values. (ex. `\"true\"`, `\"123\"`)\n- The KeyVRoot/KeyVSet `.value(...)` method has been reworked to be less strict.\n- Methods for reading type-strict values have been added to KeyV. (`.int(...)`, `.float(...)`, `.string()`, `.bool()`, `.vector(...)`)\n\n## Imports\nNote: This package, while written as an ES module, is compiled to CommonJS for backwards-compatibility. As such, the default export is emulated by including the contents of the `vdf` object in the main module.\n\n```ts\nimport vdf from 'fast-vdf';             // vdf.parse(), vdf.json(), vdf.KeyV, vdf.KeyVSet, ...\nimport { vdf } from 'fast-vdf';         // vdf.parse(), vdf.json(), KeyV, KeyVSet, ...\nimport { parse } from 'fast-vdf';       // parse(), json(), KeyV, KeyVSet, ...\n\nconst vdf = require('fast-vdf');        // vdf.parse(), vdf.json(), vdf.KeyV, vdf.KeyVSet, ...\nconst { vdf } = require('fast-vdf');    // vdf.parse(), vdf.json(), KeyV, KeyVSet, ...\nconst { parse } = require('fast-vdf');  // parse(), json(), KeyV, KeyVSet, ...\n```\n\n## Functions\n### vdf.**parse**(data: string, options?: SharedParseOptions): KeyVRoot\nParses data into a tree of `KeyV` objects.\n\n\u003e **Parameters**\n\u003e\n\u003e `data` The string to parse.\n\u003e\n\u003e `options` The parser configuration.\n\n### vdf.**json**(data: string, env: Record\u003cstring, boolean\u003e, options?: SharedParseOptions): Object\nParses data into a regular javascript object.\n\n\u003e **Parameters**\n\u003e\n\u003e `data` The string to parse.\n\u003e\n\u003e `env` An object containing condition values. (Ex. `{ \"$XBOX\": false }` will cause keys with the condition `[$XBOX]` to be ignored.)\n\u003e\n\u003e `options` The parser configuration.\n\n### core.**parse**(text: string, options: ParseOptions): void\nThe internal API used by the parse.xyz functions.\n\n\u003e **Parameters**\n\u003e\n\u003e `text` The string to parse.\n\u003e\n\u003e `options` The parser configuration.\n\n## Types\n\n### SharedParseOptions\n```ts\ninterface SharedParseOptions {\n    escapes?:    boolean; // true\n    multilines?: boolean; // false\n    types?:      boolean; // false\n}\n```\n\n### DumpFormatOptions\n```ts\ninterface DumpFormatOptions {\n    indent?:  string;                       // '\\t'\n    quote?:   'always'|'auto'|'auto-typed'; // 'always'\n    escapes?: boolean;                      // true\n}\n```\n\n### ParseOptions\n```ts\ninterface ParseOptions {\n    on_key:     (key: string, value: string, query?: string) =\u003e void;\n    on_enter:   (key: string) =\u003e void;\n    on_exit:    () =\u003e void;\n    escapes:    boolean;\n    multilines: boolean;\n    types:      boolean;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoerismo%2Fjs-fast-vdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoerismo%2Fjs-fast-vdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoerismo%2Fjs-fast-vdf/lists"}