head2json
Version:
Parses C++ files and converts the header to a JSON object.
42 lines (37 loc) • 646 B
Markdown

With [npm](https://www.npmjs.com/) installed, do
```
$ npm install head2json
```
So you have a file `example.cpp`:
```cpp
/*
INT: 1
STRING: String
List:
- ListItem1
- ListItem2
*/
using namespace std;
int main() {
cout <<"Hello World\n";
return 0;
}
```
In your NodeJS file,
```js
const parseHeader = require('head2json');
console.log(parseHeader('./example.cpp'))
```
The result is
```json
{
"INT": 1,
"STRING": "String",
"List": [ "ListItem1", "ListItem2" ]
}
```