{"id":15856940,"url":"https://github.com/ambiere/to-object","last_synced_at":"2026-02-08T20:33:36.139Z","repository":{"id":232406817,"uuid":"783878878","full_name":"ambiere/to-object","owner":"ambiere","description":"Parse string representations of objects into JavaScript objects.","archived":false,"fork":false,"pushed_at":"2024-10-12T14:14:38.000Z","size":65,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-22T00:52:34.735Z","etag":null,"topics":["javascript","json","objects","parser","strings"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/ambiere.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},"funding":{"github":"ambiere"}},"created_at":"2024-04-08T18:52:03.000Z","updated_at":"2024-10-12T14:14:42.000Z","dependencies_parsed_at":"2024-04-09T18:09:31.423Z","dependency_job_id":"627b0268-7f57-48ab-98f4-c2e4064974cf","html_url":"https://github.com/ambiere/to-object","commit_stats":{"total_commits":52,"total_committers":2,"mean_commits":26.0,"dds":"0.038461538461538436","last_synced_commit":"73bd34ae5b0880fb43ba80fcfb0140e9878d5702"},"previous_names":["ambiere/to-json","ambiere/to-object"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ambiere/to-object","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ambiere%2Fto-object","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ambiere%2Fto-object/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ambiere%2Fto-object/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ambiere%2Fto-object/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ambiere","download_url":"https://codeload.github.com/ambiere/to-object/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ambiere%2Fto-object/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29242878,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-08T19:36:48.828Z","status":"ssl_error","status_checked_at":"2026-02-08T19:27:12.336Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","json","objects","parser","strings"],"created_at":"2024-10-05T20:05:03.120Z","updated_at":"2026-02-08T20:33:36.122Z","avatar_url":"https://github.com/ambiere.png","language":"JavaScript","funding_links":["https://github.com/sponsors/ambiere"],"categories":[],"sub_categories":[],"readme":"# to-object [![ci](https://github.com/ambiere/to-object/actions/workflows/main.yml/badge.svg)](https://github.com/ambiere/to-object/actions/workflows/main.yml)\n\n\u003eLightweight utility package designed to simplify—\n\u003cbr\u003ethe process of parsing string representations of objects into JavaScript objects.\n\nAs implemented in [next-clsx](https://github.com/ambiere/clsx)\n\n\u003econtents \u003cbr\u003e1. [Installattion](#Installattion)\u003cbr\u003e2. [Use case](#Use-case)\u003cbr\u003e3. [License](#License)\n\n\n## Installattion\n\n```bash\nnpm install @ambiere/to-object\n```\n\n## Use case\n\nIn configuration files when import specifier string/path to the configuration module\ncan only be constructed dynamically, hence static imports become impractical, `require`\nnot supported in esmodule environment and dynamic imports, `import()` are not feasible\ndue to their asynchronous nature.\n\n```js\nconst configs = {\n  config1: \"first\",\n  config2: \"second\",\n  //other configs\n}\n```\n\n```js\nimport toObject from \"@ambiere/to-object\"\n\nfunction configure() {\n  // ...\n\n  /*\n  * In your code where\n  * you need to import the configs\n  * */\n\n  const configs = fs.readFileSync(\"/dynamically/constructed/import/specifier\", \"utf8\")\n  const parsedConfigs = toObject(configs)\n\n  console.log(parsedConfigs.config1) // \"first\"\n\n  // ...\n}\n```\n\nNote: The content of the configuration module/file to be read,\nshould be a valid JavaScript object\n\n## License\n\n[MIT license][MIT]\n\n[MIT]: https://github.com/ambiere/project-root/blob/main/license\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fambiere%2Fto-object","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fambiere%2Fto-object","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fambiere%2Fto-object/lists"}