{"id":19953668,"url":"https://github.com/mopsgamer/config","last_synced_at":"2026-02-10T09:02:40.368Z","repository":{"id":258358416,"uuid":"874191459","full_name":"Mopsgamer/config","owner":"Mopsgamer","description":"Node.js config library for command-line tools with strict type check.","archived":false,"fork":false,"pushed_at":"2025-01-13T18:02:31.000Z","size":551,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-13T16:09:01.447Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/Mopsgamer.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null}},"created_at":"2024-10-17T12:07:06.000Z","updated_at":"2025-01-13T18:02:35.000Z","dependencies_parsed_at":"2025-05-03T19:44:22.760Z","dependency_job_id":null,"html_url":"https://github.com/Mopsgamer/config","commit_stats":null,"previous_names":["mopsgamer/config"],"tags_count":14,"template":false,"template_full_name":"Mopsgamer/template-npm-pub-ts","purl":"pkg:github/Mopsgamer/config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mopsgamer%2Fconfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mopsgamer%2Fconfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mopsgamer%2Fconfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mopsgamer%2Fconfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mopsgamer","download_url":"https://codeload.github.com/Mopsgamer/config/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mopsgamer%2Fconfig/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259677358,"owners_count":22894677,"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":[],"created_at":"2024-11-13T01:17:14.063Z","updated_at":"2026-02-10T09:02:35.335Z","avatar_url":"https://github.com/Mopsgamer.png","language":"TypeScript","readme":"# @m234/config\n\n[![npm version](https://img.shields.io/npm/v/@m234/config.svg?style=flat)](https://www.npmjs.com/package/@m234/config)\n[![npm downloads](https://img.shields.io/npm/dm/@m234/config.svg?style=flat)](https://www.npmjs.com/package/@m234/config)\n[![github](https://img.shields.io/github/stars/Mopsgamer/config.svg?style=flat)](https://github.com/Mopsgamer/config)\n[![github issues](https://img.shields.io/github/issues/Mopsgamer/config.svg?style=flat)](https://github.com/Mopsgamer/config/issues)\n\nNode.js config library for command-line tools with strict type check. Uses yaml format.\n\n## Features\n\n- Validates the config types when loading: any, string, record, struct, integer, number, boolean.\n- Each type has options. For examlple there is the 'pattern' option for strings and numbers.\n- Struct type has dynamic properties validation ability.\n\n## Install\n\n```bash\nnpm i @m234/config\n```\n\n## Usage\n\n```ts\nimport {homedir} from \"node:os\"\nimport {exit} from \"node:process\"\nimport {join} from \"node:path\"\nimport {Config, Types} from \"@m234/config\"\n\nfunction exitFail(message: string | undefined) {\n    console.error(message)\n    process.exit(1)\n}\n\nconst aORb = Types.literal({choices: new Set(['a', 'b'])})\nconst cfg = new Config({\n    path: join(homedir(), 'app.yaml'), // or use `find-config` package\n    type: Types.struct({\n        properties:{\n            id: Types.integer({min: 0})\n            // min 8 chars password\n            password: Types.string({pattern: /.{8,}/})\n            records: Types.array({\n                elementType: aORb\n            })\n        }\n    })\n})\n\nexitFail(cfg.failLoad())\nconsole.log(cfg.get('id') === 0)\nconsole.log(cfg.getPrintable())\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmopsgamer%2Fconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmopsgamer%2Fconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmopsgamer%2Fconfig/lists"}