{"id":17077895,"url":"https://github.com/timhall/toml-patch","last_synced_at":"2025-04-12T20:24:20.694Z","repository":{"id":37692842,"uuid":"179696552","full_name":"timhall/toml-patch","owner":"timhall","description":"Patch, parse, and stringify TOML","archived":false,"fork":false,"pushed_at":"2023-01-03T19:56:56.000Z","size":1154,"stargazers_count":8,"open_issues_count":15,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-05-02T00:47:10.505Z","etag":null,"topics":["nodejs","toml","toml-parser"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/timhall.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"patreon":"timhall"}},"created_at":"2019-04-05T14:23:35.000Z","updated_at":"2023-11-02T17:24:38.000Z","dependencies_parsed_at":"2023-02-01T09:31:33.613Z","dependency_job_id":null,"html_url":"https://github.com/timhall/toml-patch","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timhall%2Ftoml-patch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timhall%2Ftoml-patch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timhall%2Ftoml-patch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timhall%2Ftoml-patch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timhall","download_url":"https://codeload.github.com/timhall/toml-patch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248626905,"owners_count":21135758,"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":["nodejs","toml","toml-parser"],"created_at":"2024-10-14T12:17:41.698Z","updated_at":"2025-04-12T20:24:20.665Z","avatar_url":"https://github.com/timhall.png","language":"TypeScript","funding_links":["https://patreon.com/timhall"],"categories":[],"sub_categories":[],"readme":"# toml-patch\n\nPatch, parse, and stringify TOML.\n\n## Installation\n\ntoml-patch is dependency-free and can be installed via npm or yarn.\n\n```\n$ npm install --save toml-patch\n```\n\nFor browser usage, you can use unpkg:\n\n```html\n\u003cscript src=\"https://unpkg.com/toml-patch\"\u003e\u003c/script\u003e\n```\n\n## API\n\n\u003ca href=\"#patch\" name=\"patch\"\u003e#\u003c/a\u003e \u003cb\u003epatch\u003c/b\u003e(\u003ci\u003eexisting\u003c/i\u003e, \u003ci\u003eupdated\u003c/i\u003e)\n\nPatch an existing TOML string with the given updated JS/JSON value, while attempting to retain the format of the existing document, including comments, indentation, and structure.\n\n```js\nconst TOML = require('toml-patch');\nconst assert = require('assert');\n\nconst existing = `\n# This is a TOML document\n\ntitle = \"TOML example\"\nowner.name = \"Bob\"\n`;\nconst patched = TOML.patch(existing, {\n  title: 'TOML example',\n  owner: {\n    name: 'Tim'\n  }\n});\n\nassert.strictEqual(\n  patched,\n  `\n# This is a TOML document\n\ntitle = \"TOML example\"\nowner.name = \"Tim\"\n`\n);\n```\n\n\u003ca href=\"#parse\" name=\"parse\"\u003e#\u003c/a\u003e \u003cb\u003eparse\u003c/b\u003e(\u003ci\u003evalue\u003c/i\u003e)\n\nParse a TOML string into a JS/JSON value.\n\n```js\nconst TOML = require('toml-patch');\nconst assert = require('assert');\n\nconst parsed = TOML.parse(`\n# This is a TOML document.\n\ntitle = \"TOML Example\"\n\n[owner]\nname = \"Tim\"`);\n\nassert.deepStrictEqual(parsed, {\n  title: 'TOML Example',\n  owner: {\n    name: 'Tim'\n  }\n});\n```\n\n\u003ca href=\"#stringify\" name=\"stringify\"\u003e#\u003c/a\u003e \u003cb\u003estringify\u003c/b\u003e(\u003ci\u003evalue\u003c/i\u003e[, \u003ci\u003eoptions\u003c/i\u003e])\n\nConvert a JS/JSON value to a TOML string. `options` can be provided for high-level formatting guidelines that follows prettier's configuration.\n\n\u003cb\u003eoptions\u003c/b\u003e\n\n- `[printWidth = 80]` - (coming soon)\n- `[trailingComma = false]` - Add trailing comma to inline tables\n- `[bracketSpacing = true]` - `true`: `{ key = \"value\" }`, `false`: `{key = \"value\"}`\n\n```js\nconst TOML = require('toml-patch');\nconst assert = require('assert');\n\nconst toml = TOML.stringify({\n  title: 'TOML Example',\n  owner: {\n    name: 'Tim'\n  }\n});\n\nassert.strictEqual(\n  toml,\n  `title = \"TOML Example\"\n\n[owner]\nname = \"Tim\"`\n);\n```\n\n## Development\n\n1. Update submodules: `git submodule update --remote`\n2. Typecheck: `npm run typecheck`\n3. Build: `npm run build`\n4. Test: `npm test`\n5. Specs compliance: `npm run specs`\n6. Benchmark: `npm run benchmark [\u003cfilter\u003e] [--help] [--example] [--reference]`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimhall%2Ftoml-patch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimhall%2Ftoml-patch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimhall%2Ftoml-patch/lists"}