Skip to content

ricsam/hcl2js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published