Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ricsam/hcl2js
https://github.com/ricsam/hcl2js
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/ricsam/hcl2js
- Owner: ricsam
- Created: 2018-12-25T05:26:53.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2018-12-26T17:50:47.000Z (almost 6 years ago)
- Last Synced: 2024-10-07T22:21:32.184Z (about 1 month ago)
- Language: JavaScript
- Size: 36.1 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# hcl to js (and js to hcl1)
```
npm install hcl2js
```
or
```
yarn add hcl2js
```## Usage
```javascript
const hcl2js = require('hcl2js');const hcl = `"output" = {
"pet" = {
"value" = "cat"
}
}`;const js = {
"output": [
{
"pet": [
{
"value": "cat"
}
]
}
]
};test('toJSON', () => {
const rep = hcl2js.toJs(hcl);
expect(rep).toEqual(js);
});test('toHCL', () => {
const rep = hcl2js.toHcl(js);
expect(rep).toEqual(hcl);
});
```Observe that the hcl is of version 1 when converting js objects to hcl