{"id":30864962,"url":"https://github.com/ioncakephper/config-dot-get","last_synced_at":"2025-09-07T20:18:59.121Z","repository":{"id":304817913,"uuid":"1001963197","full_name":"ioncakephper/config-dot-get","owner":"ioncakephper","description":"config-dot-get is a lightweight, efficient JSON configuration reader that enables easy access and modification of nested settings using dot notation. Designed for Node.js developers, it simplifies configuration management while ensuring flexibility and performance.","archived":false,"fork":false,"pushed_at":"2025-06-14T14:45:12.000Z","size":95,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-24T23:05:12.392Z","etag":null,"topics":["config-reader","configuration","data-access","developer-tools","dot-notation","file-management","json","lightweight","nodejs","npm-package","open-source","settings"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/ioncakephper.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-14T12:19:55.000Z","updated_at":"2025-06-14T15:00:49.000Z","dependencies_parsed_at":"2025-07-16T02:12:45.537Z","dependency_job_id":"379a9c02-7dec-481b-b229-6d7f2cba6f23","html_url":"https://github.com/ioncakephper/config-dot-get","commit_stats":null,"previous_names":["ioncakephper/config-dot-get"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ioncakephper/config-dot-get","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ioncakephper%2Fconfig-dot-get","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ioncakephper%2Fconfig-dot-get/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ioncakephper%2Fconfig-dot-get/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ioncakephper%2Fconfig-dot-get/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ioncakephper","download_url":"https://codeload.github.com/ioncakephper/config-dot-get/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ioncakephper%2Fconfig-dot-get/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274088646,"owners_count":25220262,"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-07T02:00:09.463Z","response_time":67,"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":["config-reader","configuration","data-access","developer-tools","dot-notation","file-management","json","lightweight","nodejs","npm-package","open-source","settings"],"created_at":"2025-09-07T20:18:57.465Z","updated_at":"2025-09-07T20:18:59.114Z","avatar_url":"https://github.com/ioncakephper.png","language":"JavaScript","readme":"# config-dot-get\n\n**config-dot-get** is a lightweight JSON configuration reader that allows developers to retrieve and modify settings using **dot notation**. It efficiently handles nested configuration values.\n\n## 🚀 Installation\n\n```sh\nnpm install config-dot-get\n```\n\n## 📖 Usage\n\n```js\nconst ConfigReader = require(\"config-dot-get\");\n\nconst config = new ConfigReader(\"config.json\");\n\n// Get a value using dot notation\nconsole.log(config.get(\"transpile.debug\", true)); // Returns the value or default (true)\n\n// Set a value\nconfig.set(\"logging.level\", \"info\");\nconsole.log(config.get(\"logging.level\")); // \"info\"\n```\n\n## ✨ Features\n\n- Supports dot notation for accessing nested keys.\n- Allows modifying settings dynamically with .set().\n- Automatically saves changes to the JSON file.\n- Provides default values if a key is missing.\n\n## 📌 Examples\n\n🔹 Basic Usage\n\n```js\nconst ConfigDotGet = require(\"config-dot-get\");\n\nconst config = new ConfigReader(\"config.json\");\n\n// Retrieve a top-level value\nconsole.log(config.get(\"app.name\")); // Example output: \"MyApp\"\n\n// Retrieve a nested value using dot notation\nconsole.log(config.get(\"database.host\")); // Example output: \"localhost\"\n\n// Provide a default value if the key is missing\nconsole.log(config.get(\"server.port\", 3000)); // Example output: 3000 (default)\n```\n\n🔹 Setting Values\n\n```js\n// Modify a value dynamically\nconfig.set(\"logging.level\", \"debug\");\n\n// Retrieve the updated value\nconsole.log(config.get(\"logging.level\")); // Example output: \"debug\"\n```\n\n🔹 Handling missing values\n\n```js\nconsole.log(config.get(\"feature.enable\", false)); // Returns default (false)\n```\n\n🔹 Working with Nested Configuration\n\n```js\n// Config structure (config.json)\n// {\n//   \"database\": {\n//     \"host\": \"localhost\",\n//     \"port\": 5432\n//   }\n// }\n\n// Access nested values\nconsole.log(config.get(\"database.port\")); // Example output: 5432\n```\n\n## 🏆 Best Practices\n\n1. **Use default values**: Always provide a default value when retrieving configuration settings to avoid unexpected `undefined` values.\n\n   ```js\n   const port = config.get(\"server.port\", 3000);\n   ```\n\n2. **Keep configuration organized**: Structure JSON files logically to prevent deep nesting that may be difficult to maintain.\n3. **Validate input**: Ensure the retrieved values match expected data types to prevent runtime issues.\n\n   ```js\n   const logLevel = config.get(\"logging.level\", \"info\");\n   if (typeof logLevel !== \"string\") {\n    throw new Error(\"Invalid log level type\");\n   }\n   ```\n\n4. **Avoid hardcoding paths**: Store key paths in constants for better maintainability.\n\n   ```js\n   const SERVER_PORT = \"server.port\";\n   const port = config.get(SERVER_PORT, 3000);\n   ```\n\n5. **Use `.set()` responsibly**: Modify configuration settings only when necessary to prevent unintended overrides.\n\n   ```js\n   config.set(\"feature.enabled\", true);\n   ```\n\n## 🛠 License\n\nThis package is licensed under MIT License.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fioncakephper%2Fconfig-dot-get","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fioncakephper%2Fconfig-dot-get","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fioncakephper%2Fconfig-dot-get/lists"}