hcl2js

0.0.5 • Public • Published

hcl to js (and js to hcl1)

npm install hcl2js

or

yarn add hcl2js

Usage

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

Readme

Keywords

none

Package Sidebar

Install

npm i hcl2js

Weekly Downloads

2

Version

0.0.5

License

ISC

Unpacked Size

1.32 MB

Total Files

6

Last publish

Collaborators

  • ricsam