# hocon-parser

> This is a very basic [Hocon](https://github.com/typesafehub/config/blob/master/HOCON.md) parser written in JavaScript.

Latest version **1.0.1** (published 2017-08-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install hocon-parser
pnpm add hocon-parser
yarn add hocon-parser
bun add hocon-parser
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-08-21 |
| First published | 2017-08-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 38 |
| Author | Maor Rosenfeld |
| Maintainers | yellowblood |

## Links

- npm: https://www.npmjs.com/package/hocon-parser
- Repository: https://github.com/yellowblood/hocon-js
- Homepage: https://github.com/yellowblood/hocon-js#readme
- Issues: https://github.com/yellowblood/hocon-js/issues
- npm.io page: https://npm.io/package/hocon-parser

## Recent versions

- 1.0.1 (latest) — 2017-08-21
- 1.0.0 — 2017-08-21

## README

[![Travis Build Status](https://travis-ci.org/yellowblood/hocon-js.svg?branch=master)](https://travis-ci.org/yellowblood/hocon-js)

# HoconJS

This is a very basic [Hocon](https://github.com/typesafehub/config/blob/master/HOCON.md) parser written in JavaScript.

It does almost no validation whatsoever but can create an object from most hocon files.

Please feel free to contribute with PRs.

This module is intended to work in the browser and nodejs.    

Browser usage :  
```
<script type="text/javascript" src="/node_modules/hocon-parser/hocon.min.js"></script>
<script type="text/javascript">
    var obj = parseHocon(someHoconText);
</script>
```

NodeJS :  
```
var parseHocon = require('hocon-parser');
var obj = parseHocon(someHoconText);
```

## Scripts  
* Installing : `npm install hocon-parser`
* Running tests : `npm test`  
* Building source : `npm run release`

## Example Output

**Input Hocon string:**

```
  myConfig.cool.numb: 5
  myConfig.cool.stuff: {
     x : quotesarebadmmkay
     z : {
       yes: 'no not really'
     }
  }
  myConfig.cool.stuff { z { no='yes yes really' } }
  myConfig.dupe: ${myConfig.cool.stuff.x}
  meinarr [2,3, {x:haha}]
  meinobj {hocon: issoweirdman}
  notherobj : ${meinobj.hocon}
```

**Output object:**
```
{
  "myConfig": {
    "cool": {
      "numb": 5,
      "stuff": {
        "x": "quotesarebadmmkay",
        "z": {
          "yes": "no not really",
          "no": "yes yes really"
        }
      }
    },
    "dupe": "quotesarebadmmkay"
  },
  "meinarr": [2, 3, {
    "x": "haha"
  }],
  "meinobj": {
    "hocon": "issoweirdman"
  },
  "notherobj": "issoweirdman"
}
```

## Features

| Feature | Completion  | Example
|---------|-------------|--------|
| Objects | :white_check_mark: | `myKey { myOtherKey: 'myValue' }`
| Arrays | :white_check_mark: | `myKey [1,2,3,4]`
| Comments | :white_check_mark: | `// some comment` `# some comment`
| `=` and `:` Separators | :white_check_mark: | `myKey='myValue'`
| Unquoted Strings | :white_check_mark: | `myKey: myString`
| Multiline Strings (`"""`) |  :white_check_mark: | `myKey: """what's happening"""`
| Path Expressions |  :white_check_mark: | `myRoot.myKey.someKey : 4`
| Substitutions |  :white_check_mark: | `myKey: $(myRoot.myKey)`
| String Concatenation in Arrays | :white_check_mark: | `myArr: [hello there]` |
| Objects Merging | :x: | |
| Value Concatenation | :x: | |
| `include` | :x: | | |

---
_Source: https://npm.io/package/hocon-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
