{"_id":"@budhash/confix","_rev":"2-3be9bd4ebf17569e1294bba26acb8d44","name":"@budhash/confix","dist-tags":{"latest":"2.1.0"},"versions":{"2.0.0":{"name":"@budhash/confix","version":"2.0.0","keywords":["config","configuration","properties","ini","yaml","editor","sed","confix"],"author":{"name":"Budhaditya Das","email":"budhash@gmail.com"},"license":"Apache-2.0","_id":"@budhash/confix@2.0.0","maintainers":[{"name":"budhash","email":"budhash@gmail.com"}],"homepage":"https://github.com/budhash/confix#readme","bugs":{"url":"https://github.com/budhash/confix/issues"},"bin":{"confix":"bin/confix.js"},"dist":{"shasum":"4bd77a2e8c677b23842170ed9fa3225da63d497d","tarball":"https://registry.npmjs.org/@budhash/confix/-/confix-2.0.0.tgz","fileCount":7,"integrity":"sha512-9hEDotH2AuRUBNikGVtW/6/Oot254TD3+DNif6krd4JOHQR3QlV/Q1kGV3sTzN69OcVtgx366AUhxrnrPsVoVA==","signatures":[{"sig":"MEYCIQCdhrKt78g9eECc40iWJ/JVcBANWSJDiT7kC94TV5TnLgIhAP3nik6cJ0mUFxue6FTWh3lVuG1mpXt/5BuoPNm0mmCz","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30501},"main":"src/confix.js","type":"commonjs","types":"confix.d.ts","module":"src/confix.mjs","engines":{"node":">=14"},"exports":{".":{"types":"./confix.d.ts","import":"./src/confix.mjs","require":"./src/confix.js"},"./package.json":"./package.json"},"gitHead":"0371394a89318d943635769986df359a1bc54730","scripts":{"test":"node --test","build:docs":"node scripts/build-docs.js","prepublishOnly":"node --test"},"_npmUser":{"name":"budhash","email":"budhash@gmail.com"},"repository":{"url":"git+https://github.com/budhash/confix.git","type":"git","directory":"js"},"_npmVersion":"11.5.1","description":"Faithful JavaScript port of the confix config-file editor core — update, add, comment, uncomment and delete keys in properties/YAML/INI-style files. Pure text-to-text, zero dependencies.","directories":{},"_nodeVersion":"22.17.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/confix_2.0.0_1788676378593_0.8044557851972032","host":"s3://npm-registry-packages-npm-production"}},"2.1.0":{"name":"@budhash/confix","version":"2.1.0","description":"Faithful JavaScript port of the confix config-file editor core — update, add, comment, uncomment and delete keys in properties/YAML/INI-style files. Pure text-to-text, zero dependencies.","keywords":["config","configuration","properties","ini","yaml","editor","sed","confix"],"license":"Apache-2.0","author":{"name":"Budhaditya Das","email":"budhash@gmail.com"},"homepage":"https://github.com/budhash/confix#readme","repository":{"type":"git","url":"git+https://github.com/budhash/confix.git","directory":"js"},"bugs":{"url":"https://github.com/budhash/confix/issues"},"type":"commonjs","main":"src/confix.js","module":"src/confix.mjs","types":"confix.d.ts","bin":{"confix":"bin/confix.js"},"exports":{".":{"types":"./confix.d.ts","import":"./src/confix.mjs","require":"./src/confix.js"},"./package.json":"./package.json"},"engines":{"node":">=14"},"publishConfig":{"access":"public"},"scripts":{"test":"node --test","build:docs":"node scripts/build-docs.js","prepublishOnly":"node --test"},"gitHead":"93139e25767259a6c908476508092b15f6aaae18","_id":"@budhash/confix@2.1.0","_nodeVersion":"20.20.2","_npmVersion":"11.19.1","dist":{"integrity":"sha512-n72dOcOdC8GJKPdDQsfOmJ5XuTGQwc9L+HY8hUm223CEK9jT0gi2jQnnRo6VKPOkEt8owlmSkkOexoSwaWeuKA==","shasum":"49fd3efeafbfa196a8fab314ec62fca61d44c7e0","tarball":"https://registry.npmjs.org/@budhash/confix/-/confix-2.1.0.tgz","fileCount":7,"unpackedSize":31694,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@budhash%2fconfix@2.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFGuKfLjQSM5Hl+AEboYK305jrLpjwB0ygy+Aa3solKTAiEA94vKXIt8GIHJctIWbM8WPKCeIsoVaoXotZ4bP1jwAak="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:9a249699-dad6-47a8-b834-ef622871964d"}},"directories":{},"maintainers":[{"name":"budhash","email":"budhash@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/confix_2.1.0_1788728060096_0.2587745098031462"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-06T06:32:58.439Z","modified":"2026-09-06T20:54:20.521Z","2.0.0":"2026-09-06T06:32:58.916Z","2.1.0":"2026-09-06T20:54:20.238Z"},"bugs":{"url":"https://github.com/budhash/confix/issues"},"author":{"name":"Budhaditya Das","email":"budhash@gmail.com"},"license":"Apache-2.0","homepage":"https://github.com/budhash/confix#readme","keywords":["config","configuration","properties","ini","yaml","editor","sed","confix"],"repository":{"type":"git","url":"git+https://github.com/budhash/confix.git","directory":"js"},"description":"Faithful JavaScript port of the confix config-file editor core — update, add, comment, uncomment and delete keys in properties/YAML/INI-style files. Pure text-to-text, zero dependencies.","maintainers":[{"name":"budhash","email":"budhash@gmail.com"}],"readme":"# @budhash/confix\n\nA faithful JavaScript port of the [`confix`](https://github.com/budhash/confix)\nconfig-file editor's core: update, add, comment, uncomment and delete keys in\n`properties` / YAML / INI-style files. **Pure text-to-text, zero dependencies,\nno build step** — runs in Node and the browser.\n\nThe bash `confix` script is the reference implementation; this library and the\nscript are validated against one shared [conformance suite](https://github.com/budhash/confix/tree/main/test/conformance),\nso their edits match byte-for-byte. See\n[SPEC.md](https://github.com/budhash/confix/blob/main/SPEC.md) for the full\nbehavior contract.\n\n## Install\n\n```sh\nnpm install @budhash/confix\n```\n\n## Usage\n\n```js\n// ESM\nimport { apply, applyBlock, parseCommandBlock } from \"@budhash/confix\";\n\n// CommonJS\nconst { apply, applyBlock, parseCommandBlock } = require(\"@budhash/confix\");\n\nconst input = \"environment=dev\\n#debug=false\\n\";\n\napply(input, [\"environment=prod\", \">debug\", \">workers=4\"]);\n// => \"environment=prod\\ndebug=false\\nworkers=4\\n\"\n```\n\n### `apply(text, commands, opts?) → string`\n\nApplies an ordered list of commands to `text` and returns the new text. Each\ncommand's first character selects the operation:\n\n| Command      | Meaning                                                   |\n| ------------ | --------------------------------------------------------- |\n| `key=value`  | update an existing key (no-op if absent)                  |\n| `>key=value` | set the key, appending it if absent                       |\n| `>key`       | uncomment an existing key                                 |\n| `<key`       | comment out an existing key (line kept)                   |\n| `!key`       | delete the key's line entirely (active or commented)      |\n\nThe key/value split is on the **first `=`** in the command, independent of the\nfile separator.\n\n`opts`:\n\n- `sep` — separator between key and value in the file (default `\"=\"`).\n- `comment` — comment character (default `\"#\"`).\n\n```js\napply(\"gc: 1000\\n\", [\"gc=2001\"], { sep: \":\" });   // \"gc: 2001\\n\"\napply(\";debug=on\\n\", [\">debug\"], { comment: \";\" }); // \"debug=on\\n\"\n```\n\n### `applyBlock(text, block, opts?) → string`\n\nConvenience: parse a command block (one command per line, like an `-e` file) and\napply it to `text` in one call. Equivalent to\n`apply(text, parseCommandBlock(block, comment), opts)`.\n\n```js\napplyBlock(\"port=8080\\n#debug=false\\n\", \"port=9090\\n>debug\\n# a comment\");\n// => \"port=9090\\ndebug=false\\n\"\n```\n\n### `parseCommandBlock(block, comment?) → string[]`\n\nParses a multi-line command block the way an `-e` file is read: one command per\nline, skipping blank lines and lines whose first non-blank character is the\ncomment character (a comment character *inside* a value is data). Leading blanks\non kept commands are stripped.\n\n```js\nparseCommandBlock(\"a=1\\n# note\\n  >b\\n\"); // [\"a=1\", \">b\"]\n```\n\n## Command line\n\nInstalling the package provides a cross-platform `confix` command that mirrors\nthe [bash script](https://github.com/budhash/confix) flag-for-flag:\n\n```sh\nnpx @budhash/confix -f app.properties \"environment=prod\" \">debug\"\n\n# stdin -> stdout\ncat app.properties | npx @budhash/confix \"environment=prod\"\n\n# preview changes without writing (unified diff)\nnpx @budhash/confix -d -f app.properties \"environment=prod\"\n```\n\n| Flag | Meaning                                                             |\n| ---- | ------------------------------------------------------------------ |\n| `-f` | input file. `-f -`, or omitting `-f`, reads stdin.                  |\n| `-o` | output file. `-o-` prints to stdout and leaves the input untouched.|\n| `-d` | dry run: print a unified diff and write nothing.                   |\n| `-e` | external command file (one command per line).                     |\n| `-s` | separator character (default `=`).                                |\n| `-c` | comment character (default `#`).                                  |\n| `-h` | show usage.                                                        |\n\nWithout `-o`, an edit is applied in place. The Node CLI is a self-contained\nmirror of the bash tool (including its `-d` diff) and is validated against it by\nbyte-for-byte parity tests.\n\n## In the browser\n\nThe core also attaches to the global as `confix` when loaded without a module\nsystem:\n\n```html\n<script src=\"confix.js\"></script>\n<script>\n  confix.apply(\"a=1\\n\", [\"a=2\"]); // \"a=2\\n\"\n</script>\n```\n\n## License\n\nApache-2.0\n","readmeFilename":"README.md"}