All Projects → maor-rosenfeld → hocon-js

maor-rosenfeld / hocon-js

Licence: MIT License
Hocon parser for JavaScript and NodeJS

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to hocon-js

hocon
go implementation of lightbend's HOCON configuration library https://github.com/lightbend/config
Stars: ✭ 49 (+48.48%)
Mutual labels:  hocon, hocon-syntax
intellij-hocon
Standalone HOCON plugin for IntelliJ IDEA
Stars: ✭ 24 (-27.27%)
Mutual labels:  hocon
dataconf
Simple dataclasses configuration management for Python with hocon/json/yaml/properties/env-vars/dict support.
Stars: ✭ 40 (+21.21%)
Mutual labels:  hocon
HOCON-CN-Translation
Unofficial Simplified Chinese translation of HOCON.md in lightbend/config
Stars: ✭ 59 (+78.79%)
Mutual labels:  hocon
sconfig
Scala configuration library supporting HOCON for Scala, Java, Scala.js, and Scala Native
Stars: ✭ 99 (+200%)
Mutual labels:  hocon
AutoKonfig
Kotlin configuration library with batteries included
Stars: ✭ 16 (-51.52%)
Mutual labels:  hocon
DazzleConf
Incredible configuration library
Stars: ✭ 34 (+3.03%)
Mutual labels:  hocon
awesome-json-next
A Collection of What's Next for Awesome JSON (JavaScript Object Notation) for Structured (Meta) Data in Text - JSON5, HJSON, HanSON, TJSON, SON, CSON, USON, JSONX/JSON11 & Many More
Stars: ✭ 50 (+51.52%)
Mutual labels:  hocon
Config
configuration library for JVM languages using HOCON files
Stars: ✭ 5,459 (+16442.42%)
Mutual labels:  hocon

Travis Build Status

HoconJS

This is a very basic Hocon 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="https://github.com/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 myKey { myOtherKey: 'myValue' }
Arrays myKey [1,2,3,4]
Comments // some comment # some comment
= and : Separators myKey='myValue'
Unquoted Strings myKey: myString
Multiline Strings (""") myKey: """what's happening"""
Path Expressions myRoot.myKey.someKey : 4
Substitutions myKey: $(myRoot.myKey)
String Concatenation in Arrays myArr: [hello there]
Objects Merging
Value Concatenation
include
Fallbacks
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].