All Projects → hanazuki → node-jsonnet

hanazuki / node-jsonnet

Licence: MIT license
libjsonnet binding for Node.js

Programming Languages

C++
36643 projects - #6 most used programming language
javascript
184084 projects - #8 most used programming language
shell
77523 projects
typescript
32286 projects
CMake
9771 projects

Projects that are alternatives of or similar to node-jsonnet

node-gyp
Node.js native addon build tool
Stars: ✭ 8,850 (+44150%)
Mutual labels:  node-addon
Nbind
✨ Magical headers that make your C++ library accessible from JavaScript 🚀
Stars: ✭ 1,829 (+9045%)
Mutual labels:  node-addon
node-pitchfinder
A compilation of pitch detection algorithms for Javascript.
Stars: ✭ 25 (+25%)
Mutual labels:  node-addon
node-mac-contacts
Create, read, update, and delete contacts from users' contacts databases on macOS.
Stars: ✭ 48 (+140%)
Mutual labels:  node-addon

node-jsonnet

@hanazuki/node-jsonnet is a libjsonnet binding for Node.js (native addon), which supports all the basic Jsonnet functionality including import and native callbacks (std.native). It also comes with TypeScript type definitions.

Synopsis

import { Jsonnet } from "@hanazuki/node-jsonnet";
const jsonnet = new Jsonnet();

// Evaluates a simple Jsonnet program into a JSON value
jsonnet.evaluateSnippet(`{a: 1 + 2, b: self.a * 3}`)
       .then(json => console.log(JSON.parse(json)));  // => { a: 3, b: 9 }

// Jsonnet programs can use JavaScript values through external variables (std.extVar)
// and native callbacks (std.native).
jsonnet.extCode("x", "4")
       .nativeCallback("add", (a, b) => Number(a) + Number(b), "a", "b")
       .evaluateSnippet(`std.extVar("x") * std.native("add")(1, 2)`)
       .then(json => console.log(JSON.parse(json)));  // => 12

The library is documented in the TypeScript type definitions at types/index.d.ts, and HTML documentation is also available online.

Installation Requirements

  • Node.js v14 or later
  • GCC or Clang C++ compiler that supports C++17
  • CMake 3.8 or later

License

@hanazuki/node-jsonnet is licensed under the MIT License (See LICENSE file for the terms). libjsonnet, whose source code is bundled in the distributed NPM packages of @hanazuki/node-jsonnet, is licensed under the Apache License, Version 2.0 (See third_party/jsonnet/LICENSE in this package or LICENSE file in the original repository). libjsonnet also bundles third-party software that is subject to other OSS licenses.

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].