parse.config.ts
v1.0.2
Published
A TypeScript configuration file parser.
Readme
parse.config.tsis a TypeScript configuration file parser designed to make it easy to work with configuration files in TypeScript projects. It enables you to load and parse configuration files efficiently, providing a typed interface for accessing configuration properties.
Features
- Easy parsing of TypeScript configuration files.
- Returns typed configuration objects.
- Simple, lightweight, and easy to integrate.
Installation
Install parse.config.ts using npm:
npm install parse.config.tsUsage
Here's how you can use parse.config.ts to parse a configuration file:
Create a configuration file, for example,
my.config.ts:export default { key: 'value', numberKey: 42 };Use
parse.config.tsto load and parse the configuration:import { parseConfig } from 'parse.config.ts'; interface Config { key: string; numberKey: number; } async function loadConfiguration() { try { const config = await parseConfig<Config>('./my.config.ts'); console.log(config); } catch (error) { console.error('Error loading configuration:', error); } } loadConfiguration();
Contributing
Contributions are welcome! If you have a bug report, feature request, or a pull request, please feel free to contribute.
- Fork the repository.
- Create a new branch for each feature or improvement.
- Send a pull request from each feature branch.
Contact
If you have any questions or suggestions, please reach out to Daniel Boll at [email protected].
License
parse.config.ts is available under the MIT license. See the LICENSE file for more info.
