jsonata-extended
Version:
Extended JSONata object with custom functions
448 lines (159 loc) • 8.69 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>Global - Documentation</title>
<script src="scripts/prettify/prettify.js"></script>
<script src="scripts/prettify/lang-css.js"></script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
<script src="scripts/nav.js" defer></script>
<script src="https://embed.runkit.com"></script>
<style>.embedrunkit { overflow: visible; }</style>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav >
<input type="text" id="nav-search" placeholder="Search" />
<h2><a href="index.html">Home</a></h2><h2><a href="https://github.com/martinholden-skillsoft/jsonata-extended.git" target="_blank" class="menu-item" id="repository" >Github repo</a></h2><h3>Modules</h3><ul><li><a href="module-jsonata-functions.html">jsonata-functions</a><ul class='methods'><li data-type='method' style='display: none;'><a href="module-jsonata-functions.html#~decodeUuid">decodeUuid</a></li><li data-type='method' style='display: none;'><a href="module-jsonata-functions.html#~encodeUuid">encodeUuid</a></li><li data-type='method' style='display: none;'><a href="module-jsonata-functions.html#~htmltotext">htmltotext</a></li><li data-type='method' style='display: none;'><a href="module-jsonata-functions.html#~languageInfo">languageInfo</a></li><li data-type='method' style='display: none;'><a href="module-jsonata-functions.html#~moment">moment</a></li><li data-type='method' style='display: none;'><a href="module-jsonata-functions.html#~momentDuration">momentDuration</a></li><li data-type='method' style='display: none;'><a href="module-jsonata-functions.html#~mustache">mustache</a></li><li data-type='method' style='display: none;'><a href="module-jsonata-functions.html#~parsePath">parsePath</a></li><li data-type='method' style='display: none;'><a href="module-jsonata-functions.html#~parseUrl">parseUrl</a></li><li data-type='method' style='display: none;'><a href="module-jsonata-functions.html#~registerWithJSONATA">registerWithJSONATA</a></li><li data-type='method' style='display: none;'><a href="module-jsonata-functions.html#~shortenUuid">shortenUuid</a></li><li data-type='method' style='display: none;'><a href="module-jsonata-functions.html#~truncate">truncate</a></li><li data-type='method' style='display: none;'><a href="module-jsonata-functions.html#~unicodeToASCII">unicodeToASCII</a></li><li data-type='method' style='display: none;'><a href="module-jsonata-functions.html#~unshortenUuid">unshortenUuid</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#jsonataExtended">jsonataExtended</a></li></ul>
</nav>
<div id="main">
<h1 class="page-title">Global</h1>
<section>
<header>
<h2>
</h2>
</header>
<article>
<div class="container-overview">
<dl class="details">
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="jsonataExtended"><span class="type-signature"></span>jsonataExtended<span class="signature">(expr, options)</span><span class="type-signature"> → {Object}</span></h4>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="jsonata-extended.js.html">jsonata-extended.js</a>, <a href="jsonata-extended.js.html#line20">line 20</a>
</li></ul></dd>
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li><a href="https://www.npmjs.com/package/jsonata">JSONata NPM</a></li>
</ul>
</dd>
</dl>
<div class="description usertext">
Return a JSONata expression object that includes the custom functions registered
</div>
<h5>Example</h5>
<p class="code-caption">Example using the extended JSONata as a dropin replacement for the standard <a href="https://www.npmjs.com/package/jsonata">JSONata NPM</a></p>
<pre class="prettyprint"><code>// const jsonata = require('jsonata');
const jsonata = require('jsonata-extended');
const expr = jsonata('$htmltotext("<p>Leadership has a dark side; a &#34;leadership shadow&#34; that often creates an unknown; lurking fear.</p>")');
const result = expr.evaluate();</code></pre>
<h5>Try on RUNKIT</h5>
<pre class="embedrunkit">// const jsonata = require('jsonata');
const jsonata = require('jsonata-extended');
const expr = jsonata('$htmltotext("<p>Leadership has a dark side; a &#34;leadership shadow&#34; that often creates an unknown; lurking fear.</p>")');
const result = expr.evaluate();</pre>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>expr</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">JSONata expression <a href="https://www.npmjs.com/package/jsonata">JSONata NPM</a></td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">
<h6>Properties</h6>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>recover:</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last">attempt to recover on parse error</td>
</tr>
<tr>
<td class="name"><code>RegexEngine:</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">RegEx class constructor to use</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
Evaluated expression
</div>
<dl class="param-type">
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.10</a> using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/polyfill.js"></script>
<script src="scripts/linenumber.js"></script>
<script src="scripts/search.js" defer></script>
<script src="scripts/collapse.js" defer></script>
<script>
const elements = [...document.getElementsByClassName('embedrunkit')]
const notebooks = elements.reduce((notebooks, element) => {
const innerText = element.firstChild
const currentCell = window.RunKit.createNotebook({
element,
nodeVersion:"12.x.x",
source: innerText.textContent,
// Remove the text content of the pre tag after the embed has loaded
onLoad: () => innerText.remove()
})
return notebooks
}, [])</script>
</body>
</html>