1.0.0 • Published 6 years ago

botl v1.0.0

Weekly downloads
2
License
Apache License 2....
Repository
github
Last release
6 years ago

bOTL.js

bOTL Object Transformation Language v3 It's Mustache for JSON

This is a JavaScript implementation of bOTL v3.

Get started by reading the bOTL specification at Medium.

Usage

Node.js

const botl = require("botl");

let source = {"name": "Freddo"};
let transform = "#$.name";

let result = botl.transform(source, transform);
// result: "Freddo" 

Web

Just grab the file bOTL.js and use it like this:

<script type="text/javascript" src="bOTL.js"></script>

<script>
  let source = {"name": "Freddo"};
  let transform = "#$.name";

  let result = bOTL.transform(source, transform);
  // result: "Freddo"
</script>

Using Github as a CDN

Don't want to download anything at all? Try this fiddle. Note that this uses a Github Pages url (https://emlynoregan.github.io/bOTL_js/bOTL.js), which has usage limits.

Miscelaneous

You can also use a package manager like yarn, npm or bower (deprecated).

Acknowledgements

bOTL.js includes Stefan Goessner's JSONPath implementation, released under an MIT license.