{"id":31033520,"url":"https://github.com/sgarciac/bombadil","last_synced_at":"2025-09-14T01:57:38.048Z","repository":{"id":20800678,"uuid":"86494648","full_name":"sgarciac/bombadil","owner":"sgarciac","description":"TOML parser in typescript","archived":false,"fork":false,"pushed_at":"2023-01-04T22:18:01.000Z","size":881,"stargazers_count":27,"open_issues_count":18,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-06-11T18:09:19.566Z","etag":null,"topics":["javascript","toml","toml-parser","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sgarciac.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-28T18:39:41.000Z","updated_at":"2023-08-19T06:11:59.000Z","dependencies_parsed_at":"2023-01-11T20:59:06.732Z","dependency_job_id":null,"html_url":"https://github.com/sgarciac/bombadil","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/sgarciac/bombadil","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgarciac%2Fbombadil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgarciac%2Fbombadil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgarciac%2Fbombadil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgarciac%2Fbombadil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sgarciac","download_url":"https://codeload.github.com/sgarciac/bombadil/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgarciac%2Fbombadil/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275051635,"owners_count":25396977,"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","status":"online","status_checked_at":"2025-09-13T02:00:10.085Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["javascript","toml","toml-parser","typescript"],"created_at":"2025-09-14T01:57:36.599Z","updated_at":"2025-09-14T01:57:38.040Z","avatar_url":"https://github.com/sgarciac.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bombadil\nCopyright Sergio Garcia\n\nA [chevrotain](https://github.com/SAP/chevrotain) based [TOML v0.5.0](https://github.com/toml-lang/toml) parser, written in typescript.\n\n## Releases\n\n  * TOML 0.5: [Bombadil 2.3.0](https://www.npmjs.com/package/@sgarciac/bombadil/v/2.3.0)\n  * TOML 0.5: [Bombadil 2.0.0](https://www.npmjs.com/package/@sgarciac/bombadil/v/2.0.0)\n  * TOML 0.5: [Bombadil 2.0.0-1 (prerelease)](https://www.npmjs.com/package/@sgarciac/bombadil/v/2.0.0-1)\n  * TOML 0.4: [Bombadil 1.0.0 (stable)](https://www.npmjs.com/package/@sgarciac/bombadil/v/1.0.0)\n\n## Install\n\n```sh\nnpm install @sgarciac/bombadil\n```\n\n## Usage\n\n```javascript\nvar bombadil = require('@sgarciac/bombadil')\nvar input = 'whatever = 1'\nvar reader = new bombadil.TomlReader\nreader.readToml(input)\nreader.result // -\u003e {whatever: 1}\n```\n\n### Errors\n\nIf the input is not a valid TOML string, the reader will store ```undefined``` in its ```result``` property and it will keep the errors in its ```errors``` property. Errors can be either:\n\n  * Lexer errors: [ILexingError](http://sap.github.io/chevrotain/documentation/0_28_3/interfaces/_chevrotain_d_.ilexingerror.html)\n  * Parser errors: [IRecognitionException](http://sap.github.io/chevrotain/documentation/0_28_3/interfaces/_chevrotain_d_.exceptions.irecognitionexception.html)\n  * Table loading errors:\n    ```typescript\n    export interface ITomlException {\n    message: string,\n    token: ct.IToken\n    }\n    ```\n    which uses [IToken](http://sap.github.io/chevrotain/documentation/0_28_3/interfaces/_chevrotain_d_.itoken.html)\n\n## Type mapping\n\nBy default, the toml reader will map TOML values to javascript values as follows:\n\n  * Integers -\u003e Number\n  * Float -\u003e Number\n  * String -\u003e String\n  * Boolean -\u003e Boolean\n  * Offset Date Time -\u003e [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)\n  * Local Date Time -\u003e [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) (using UTC±00:00)\n  * Local Date -\u003e [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) (using UTC±00:00 and time 00:00:00)\n  * Local Time -\u003e [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) (using UTC±00:00 and date 0001-01-01)\n  * Array -\u003e Array\n  * Table -\u003e Object\n\n### Full typing information\n\nAs you can see in the previous example, there is some information loss. If you\nneed the original typing information, you can pass a second parameter to\n```readToml``` set to ```true```. \n\nThis will parse the following TOML:\n\n```toml\ntitle = \"TOML Example\"\n\n[owner]\nname = \"Tom Preston-Werner\"\ndob = 1979-05-27T07:32:00Z # First class dates? Why not?\n```\n\nto the following javascript object:\n\n```javascript\n\n{ type: 'table',\n  content:\n   { title:\n      { type: 'atomicString',\n        image: 'TOML Example',\n        value: 'TOML Example' },\n     owner:\n      { type: 'table',\n        content:\n         { name:\n            { type: 'atomicString',\n              image: 'Tom Preston-Werner',\n              value: 'Tom Preston-Werner' },\n           dob:\n            { type: 'offsetDateTime',\n              image: '1979-05-27T07:32:00Z',\n              value: 1979-05-27T07:32:00.000Z } } } } }\n```\n\nDocuments are transformed as following:\n\n * Toml's _tables_ (including the root one) and _primitive values_ (string,\n   integer, date, etc) are transformed to javascript objects with a 'type'\n   property that describe their type. For example, tables' type is the string 'table'.\n * All Toml's arrays are transformed to javascript arrays\n * Toml's tables corresponding javascript objects have a \"content\" property that\n   contains another javascript object (a dictionary), whose properties are the toml table's keys, and\n   they point to the transformation of the corresponding toml value.\n * Toml's primitive values corresponding javascript objects include their toml image (a string), and also\n   the corresponding javascript primitive value.\n   \nKeeping the original string image of the value can be helpful, for\nexample when dealing with big integers, which can not be handled by the javascript\nNumber type.\n\n\n## Known problems\n\nChevrotain is known to rely on function names, which means that minification\n(such as performed by, for example,\n[Uglify](https://github.com/mishoo/UglifyJS)) can break bombadil. There are some\nsolutions to this problem\n[here](https://github.com/SAP/chevrotain/blob/master/examples/parser/minification/README.md)\n\nUnless you are running the code inside the browser, and using minification, you\nprobably don't need to worry about this.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsgarciac%2Fbombadil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsgarciac%2Fbombadil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsgarciac%2Fbombadil/lists"}