Skip to content

anhldbk/node-hcl-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HCL Parser

A better HCL parser for Javascript applications

Overview

This parser is transpiled from hashicorp/hcl using GopherJS.

Installation

npm install hcl-parser

Usage

import {parse} from "hcl-parser"

const input = `
  allow {
    user = "admin"
  }

  deny {
    user = "anonymous"
  }
`

const [data, err] = parse(input);

if(err == null){
  // data is the JSON object you want
} else {
  // handle error
}

Development

In case you may want to reproduce this library

Build

The associated code can be found here anhldbk/hcl-parser

To build the parser:

# Install GopherJS first
go get -u github.com/gopherjs/gopherjs

# Build JS package
gopherjs build github.com/anhldbk/hcl-parser -o lib/parser.js -m

Test

npm test

About

A better HCL parser for Javascript applications

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published