Skip to content

rbicker/node-jsonnet

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-jsonnet

Changes from original repository

  • Updated Jsonnet Library (Build date: 2019-03-15)
  • Updated dependencies
  • Moved all dependencies to devDependencies where they belong

Jsonnet example

before:

// Jsonnet Example
{
    person1: {
        name: "Alice",
        welcome: "Hello " + self.name + "!",
    },
    person2: self.person1 { name: "Bob" },
}

after:

{
   "person1": {
      "name": "Alice",
      "welcome": "Hello Alice!"
   },
   "person2": {
      "name": "Bob",
      "welcome": "Hello Bob!"
   }
}

Usage

$ npm install @rbicker/jsonnet --save
const Jsonnet = require('@rbicker/jsonnet');
const fs = require('fs');

const code = fs.readFileSync("./menu.jsonnet");

const jsonnet = new Jsonnet();
// eval jsonnet to json
const result = jsonnet.eval(code);

console.log(result);

About

jsonnet wrapper for Node.js

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 85.4%
  • Jsonnet 14.6%