UNPKG

@astronautlabs/jsonpath

Version:

Query JavaScript objects with JSONPath expressions. Robust / safe JSONPath engine for Node.js.

745 lines (742 loc) 39.3 kB
<!doctype html> <html class="default no-js"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>@astronautlabs/jsonpath</title> <meta name="description" content="Documentation for @astronautlabs/jsonpath"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="assets/css/main.css"> </head> <body> <header> <div class="tsd-page-toolbar"> <div class="container"> <div class="table-wrap"> <div class="table-cell" id="tsd-search" data-index="assets/js/search.json" data-base="."> <div class="field"> <label for="tsd-search-field" class="tsd-widget search no-caption">Search</label> <input id="tsd-search-field" type="text" /> </div> <ul class="results"> <li class="state loading">Preparing search index...</li> <li class="state failure">The search index is not available</li> </ul> <a href="index.html" class="title">@astronautlabs/jsonpath</a> </div> <div class="table-cell" id="tsd-widgets"> <div id="tsd-filter"> <a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a> <div class="tsd-filter-group"> <div class="tsd-select" id="tsd-filter-visibility"> <span class="tsd-select-label">All</span> <ul class="tsd-select-list"> <li data-value="public">Public</li> <li data-value="protected">Public/Protected</li> <li data-value="private" class="selected">All</li> </ul> </div> <input type="checkbox" id="tsd-filter-inherited" checked /> <label class="tsd-widget" for="tsd-filter-inherited">Inherited</label> </div> </div> <a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a> </div> </div> </div> </div> <div class="tsd-page-title"> <div class="container"> <ul class="tsd-breadcrumb"> <li> <a href="globals.html">Globals</a> </li> </ul> <h1>@astronautlabs/jsonpath</h1> </div> </div> </header> <div class="container container-main"> <div class="row"> <div class="col-8 col-content"> <div class="tsd-panel tsd-typography"> <a href="#jsonpath-" id="jsonpath-" style="color: inherit; text-decoration: none;"> <h1>@/jsonpath <a href="https://circleci.com/gh/astronautlabs/jsonpath"><img src="https://circleci.com/gh/astronautlabs/jsonpath.svg?style=svg" alt="CircleCI"></a></h1> </a> <p><a href="https://npmjs.com/package/@astronautlabs/jsonpath"><img src="https://img.shields.io/npm/v/@astronautlabs/jsonpath?style=flat-square" alt="npm (scoped)"></a></p> <p>Query JavaScript objects with JSONPath expressions. Robust / safe JSONPath engine for Node.js.</p> <a href="#query-example" id="query-example" style="color: inherit; text-decoration: none;"> <h2>Query Example</h2> </a> <pre><code class="language-javascript"><span class="hljs-keyword">import</span> { JSONPath } <span class="hljs-keyword">from</span> <span class="hljs-string">'@astronautlabs/jsonpath'</span>; <span class="hljs-keyword">let</span> cities = [ { <span class="hljs-attr">name</span>: <span class="hljs-string">"London"</span>, <span class="hljs-string">"population"</span>: <span class="hljs-number">8615246</span> }, { <span class="hljs-attr">name</span>: <span class="hljs-string">"Berlin"</span>, <span class="hljs-string">"population"</span>: <span class="hljs-number">3517424</span> }, { <span class="hljs-attr">name</span>: <span class="hljs-string">"Madrid"</span>, <span class="hljs-string">"population"</span>: <span class="hljs-number">3165235</span> }, { <span class="hljs-attr">name</span>: <span class="hljs-string">"Rome"</span>, <span class="hljs-string">"population"</span>: <span class="hljs-number">2870528</span> } ]; <span class="hljs-keyword">let</span> names = JSONPath.query(cities, <span class="hljs-string">'$..name'</span>); <span class="hljs-comment">// [ "London", "Berlin", "Madrid", "Rome" ]</span></code></pre> <a href="#install" id="install" style="color: inherit; text-decoration: none;"> <h2>Install</h2> </a> <p>Install from npm:</p> <pre><code class="language-bash">$ npm install @astronautlabs/jsonpath</code></pre> <a href="#jsonpath-syntax" id="jsonpath-syntax" style="color: inherit; text-decoration: none;"> <h2>JSONPath Syntax</h2> </a> <p>Here are syntax and examples adapted from <a href="http://goessner.net/articles/JsonPath/">Stefan Goessner&#39;s original post</a> introducing JSONPath in 2007.</p> <table> <thead> <tr> <th>JSONPath</th> <th>Description</th> </tr> </thead> <tbody><tr> <td><code>$</code></td> <td>The root object/element</td> </tr> <tr> <td><code>@</code></td> <td>The current object/element</td> </tr> <tr> <td><code>.</code></td> <td>Child member operator</td> </tr> <tr> <td><code>..</code></td> <td>Recursive descendant operator; JSONPath borrows this syntax from E4X</td> </tr> <tr> <td><code>*</code></td> <td>Wildcard matching all objects/elements regardless their names</td> </tr> <tr> <td><code>[]</code></td> <td>Subscript operator</td> </tr> <tr> <td><code>[,]</code></td> <td>Union operator for alternate names or array indices as a set</td> </tr> <tr> <td><code>[start:end:step]</code></td> <td>Array slice operator borrowed from ES4 / Python</td> </tr> <tr> <td><code>?()</code></td> <td>Applies a filter (script) expression via static evaluation</td> </tr> <tr> <td><code>()</code></td> <td>Script expression via static evaluation</td> </tr> </tbody></table> <p>Given this sample data set, see example expressions below:</p> <pre><code class="language-javascript">{ <span class="hljs-string">"store"</span>: { <span class="hljs-string">"book"</span>: [ { <span class="hljs-string">"category"</span>: <span class="hljs-string">"reference"</span>, <span class="hljs-string">"author"</span>: <span class="hljs-string">"Nigel Rees"</span>, <span class="hljs-string">"title"</span>: <span class="hljs-string">"Sayings of the Century"</span>, <span class="hljs-string">"price"</span>: <span class="hljs-number">8.95</span> }, { <span class="hljs-string">"category"</span>: <span class="hljs-string">"fiction"</span>, <span class="hljs-string">"author"</span>: <span class="hljs-string">"Evelyn Waugh"</span>, <span class="hljs-string">"title"</span>: <span class="hljs-string">"Sword of Honour"</span>, <span class="hljs-string">"price"</span>: <span class="hljs-number">12.99</span> }, { <span class="hljs-string">"category"</span>: <span class="hljs-string">"fiction"</span>, <span class="hljs-string">"author"</span>: <span class="hljs-string">"Herman Melville"</span>, <span class="hljs-string">"title"</span>: <span class="hljs-string">"Moby Dick"</span>, <span class="hljs-string">"isbn"</span>: <span class="hljs-string">"0-553-21311-3"</span>, <span class="hljs-string">"price"</span>: <span class="hljs-number">8.99</span> }, { <span class="hljs-string">"category"</span>: <span class="hljs-string">"fiction"</span>, <span class="hljs-string">"author"</span>: <span class="hljs-string">"J. R. R. Tolkien"</span>, <span class="hljs-string">"title"</span>: <span class="hljs-string">"The Lord of the Rings"</span>, <span class="hljs-string">"isbn"</span>: <span class="hljs-string">"0-395-19395-8"</span>, <span class="hljs-string">"price"</span>: <span class="hljs-number">22.99</span> } ], <span class="hljs-string">"bicycle"</span>: { <span class="hljs-string">"color"</span>: <span class="hljs-string">"red"</span>, <span class="hljs-string">"price"</span>: <span class="hljs-number">19.95</span> } } }</code></pre> <p>Example JSONPath expressions:</p> <table> <thead> <tr> <th>JSONPath</th> <th>Description</th> </tr> </thead> <tbody><tr> <td><code>$.store.book[*].author</code></td> <td>The authors of all books in the store</td> </tr> <tr> <td><code>$..author</code></td> <td>All authors</td> </tr> <tr> <td><code>$.store.*</code></td> <td>All things in store, which are some books and a red bicycle</td> </tr> <tr> <td><code>$.store..price</code></td> <td>The price of everything in the store</td> </tr> <tr> <td><code>$..book[2]</code></td> <td>The third book</td> </tr> <tr> <td><code>$..book[(@.length-1)]</code></td> <td>The last book via script subscript</td> </tr> <tr> <td><code>$..book[-1:]</code></td> <td>The last book via slice</td> </tr> <tr> <td><code>$..book[0,1]</code></td> <td>The first two books via subscript union</td> </tr> <tr> <td><code>$..book[:2]</code></td> <td>The first two books via subscript array slice</td> </tr> <tr> <td><code>$..book[?(@.isbn)]</code></td> <td>Filter all books with isbn number</td> </tr> <tr> <td><code>$..book[?(@.price&lt;10)]</code></td> <td>Filter all books cheaper than 10</td> </tr> <tr> <td><code>$..book[?(@.price==8.95)]</code></td> <td>Filter all books that cost 8.95</td> </tr> <tr> <td><code>$..book[?(@.price&lt;30 &amp;&amp; @.category==&quot;fiction&quot;)]</code></td> <td>Filter all fiction books cheaper than 30</td> </tr> <tr> <td><code>$..*</code></td> <td>All members of JSON structure</td> </tr> </tbody></table> <a href="#methods" id="methods" style="color: inherit; text-decoration: none;"> <h2>Methods</h2> </a> <a href="#jsonpathqueryobj-pathexpression-count" id="jsonpathqueryobj-pathexpression-count" style="color: inherit; text-decoration: none;"> <h4>JSONPath.query(obj, pathExpression[, count])</h4> </a> <p>Find elements in <code>obj</code> matching <code>pathExpression</code>. Returns an array of elements that satisfy the provided JSONPath expression, or an empty array if none were matched. Returns only first <code>count</code> elements if specified.</p> <pre><code class="language-javascript"><span class="hljs-keyword">let</span> authors = jp.query(data, <span class="hljs-string">'$..author'</span>); <span class="hljs-comment">// [ 'Nigel Rees', 'Evelyn Waugh', 'Herman Melville', 'J. R. R. Tolkien' ]</span></code></pre> <a href="#jsonpathpathsobj-pathexpression-count" id="jsonpathpathsobj-pathexpression-count" style="color: inherit; text-decoration: none;"> <h4>JSONPath.paths(obj, pathExpression[, count])</h4> </a> <p>Find paths to elements in <code>obj</code> matching <code>pathExpression</code>. Returns an array of element paths that satisfy the provided JSONPath expression. Each path is itself an array of keys representing the location within <code>obj</code> of the matching element. Returns only first <code>count</code> paths if specified.</p> <pre><code class="language-javascript"><span class="hljs-keyword">let</span> paths = jp.paths(data, <span class="hljs-string">'$..author'</span>); <span class="hljs-comment">// [</span> <span class="hljs-comment">// ['$', 'store', 'book', 0, 'author'] },</span> <span class="hljs-comment">// ['$', 'store', 'book', 1, 'author'] },</span> <span class="hljs-comment">// ['$', 'store', 'book', 2, 'author'] },</span> <span class="hljs-comment">// ['$', 'store', 'book', 3, 'author'] }</span> <span class="hljs-comment">// ]</span></code></pre> <a href="#jsonpathnodesobj-pathexpression-count" id="jsonpathnodesobj-pathexpression-count" style="color: inherit; text-decoration: none;"> <h4>JSONPath.nodes(obj, pathExpression[, count])</h4> </a> <p>Find elements and their corresponding paths in <code>obj</code> matching <code>pathExpression</code>. Returns an array of node objects where each node has a <code>path</code> containing an array of keys representing the location within <code>obj</code>, and a <code>value</code> pointing to the matched element. Returns only first <code>count</code> nodes if specified.</p> <pre><code class="language-javascript"><span class="hljs-keyword">let</span> nodes = jp.nodes(data, <span class="hljs-string">'$..author'</span>); <span class="hljs-comment">// [</span> <span class="hljs-comment">// { path: ['$', 'store', 'book', 0, 'author'], value: 'Nigel Rees' },</span> <span class="hljs-comment">// { path: ['$', 'store', 'book', 1, 'author'], value: 'Evelyn Waugh' },</span> <span class="hljs-comment">// { path: ['$', 'store', 'book', 2, 'author'], value: 'Herman Melville' },</span> <span class="hljs-comment">// { path: ['$', 'store', 'book', 3, 'author'], value: 'J. R. R. Tolkien' }</span> <span class="hljs-comment">// ]</span></code></pre> <a href="#jsonpathvalueobj-pathexpression-newvalue" id="jsonpathvalueobj-pathexpression-newvalue" style="color: inherit; text-decoration: none;"> <h4>JSONPath.value(obj, pathExpression[, newValue])</h4> </a> <p>Returns the value of the first element matching <code>pathExpression</code>. If <code>newValue</code> is provided, sets the value of the first matching element and returns the new value.</p> <a href="#jsonpathparentobj-pathexpression" id="jsonpathparentobj-pathexpression" style="color: inherit; text-decoration: none;"> <h4>JSONPath.parent(obj, pathExpression)</h4> </a> <p>Returns the parent of the first matching element.</p> <a href="#jsonpathapplyobj-pathexpression-fn" id="jsonpathapplyobj-pathexpression-fn" style="color: inherit; text-decoration: none;"> <h4>JSONPath.apply(obj, pathExpression, fn)</h4> </a> <p>Runs the supplied function <code>fn</code> on each matching element, and replaces each matching element with the return value from the function. The function accepts the value of the matching element as its only parameter. Returns matching nodes with their updated values.</p> <pre><code class="language-javascript"><span class="hljs-keyword">let</span> nodes = jp.apply(data, <span class="hljs-string">'$..author'</span>, <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">value</span>) </span>{ <span class="hljs-keyword">return</span> value.toUpperCase() }); <span class="hljs-comment">// [</span> <span class="hljs-comment">// { path: ['$', 'store', 'book', 0, 'author'], value: 'NIGEL REES' },</span> <span class="hljs-comment">// { path: ['$', 'store', 'book', 1, 'author'], value: 'EVELYN WAUGH' },</span> <span class="hljs-comment">// { path: ['$', 'store', 'book', 2, 'author'], value: 'HERMAN MELVILLE' },</span> <span class="hljs-comment">// { path: ['$', 'store', 'book', 3, 'author'], value: 'J. R. R. TOLKIEN' }</span> <span class="hljs-comment">// ]</span></code></pre> <a href="#jsonpathparsepathexpression" id="jsonpathparsepathexpression" style="color: inherit; text-decoration: none;"> <h4>JSONPath.parse(pathExpression)</h4> </a> <p>Parse the provided JSONPath expression into path components and their associated operations.</p> <pre><code class="language-javascript"><span class="hljs-keyword">let</span> path = jp.parse(<span class="hljs-string">'$..author'</span>); <span class="hljs-comment">// [</span> <span class="hljs-comment">// { expression: { type: 'root', value: '$' } },</span> <span class="hljs-comment">// { expression: { type: 'identifier', value: 'author' }, operation: 'member', scope: 'descendant' }</span> <span class="hljs-comment">// ]</span></code></pre> <a href="#jsonpathstringifypath" id="jsonpathstringifypath" style="color: inherit; text-decoration: none;"> <h4>JSONPath.stringify(path)</h4> </a> <p>Returns a path expression in string form, given a path. The supplied path may either be a flat array of keys, as returned by <code>jp.nodes</code> for example, or may alternatively be a fully parsed path expression in the form of an array of path components as returned by <code>jp.parse</code>.</p> <pre><code class="language-javascript"><span class="hljs-keyword">let</span> pathExpression = jp.stringify([<span class="hljs-string">'$'</span>, <span class="hljs-string">'store'</span>, <span class="hljs-string">'book'</span>, <span class="hljs-number">0</span>, <span class="hljs-string">'author'</span>]); <span class="hljs-comment">// "$.store.book[0].author"</span></code></pre> <a href="#differences-from-original-implementation" id="differences-from-original-implementation" style="color: inherit; text-decoration: none;"> <h2>Differences from Original Implementation</h2> </a> <p>This implementation aims to be compatible with Stefan Goessner&#39;s original implementation with a few notable exceptions described below.</p> <a href="#evaluating-script-expressions" id="evaluating-script-expressions" style="color: inherit; text-decoration: none;"> <h4>Evaluating Script Expressions</h4> </a> <p>Script expressions (i.e, <code>(...)</code> and <code>?(...)</code>) are statically evaluated via <a href="https://github.com/substack/static-eval">static-eval</a> rather than using the underlying script engine directly. That means both that the scope is limited to the instance variable (<code>@</code>), and only simple expressions (with no side effects) will be valid. So for example, <code>?(@.length&gt;10)</code> will be just fine to match arrays with more than ten elements, but <code>?(process.exit())</code> will not get evaluated since <code>process</code> would yield a <code>ReferenceError</code>. This method is even safer than <code>vm.runInNewContext</code>, since the script engine itself is more limited and entirely distinct from the one running the application code. See more details in the <a href="https://github.com/substack/static-eval/blob/master/index.js">implementation</a> of the evaluator.</p> <a href="#grammar" id="grammar" style="color: inherit; text-decoration: none;"> <h4>Grammar</h4> </a> <p>This project uses a formal BNF <a href="https://github.com/dchester/jsonpath/blob/master/lib/grammar.js">grammar</a> to parse JSONPath expressions, an attempt at reverse-engineering the intent of the original implementation, which parses via a series of creative regular expressions. The original regex approach can sometimes be forgiving for better or for worse (e.g., <code>$[&#39;store]</code> =&gt; <code>$[&#39;store&#39;]</code>), and in other cases, can be just plain wrong (e.g. <code>[</code> =&gt; <code>$</code>). </p> <a href="#other-minor-differences" id="other-minor-differences" style="color: inherit; text-decoration: none;"> <h4>Other Minor Differences</h4> </a> <p>As a result of using a real parser and static evaluation, there are some arguable bugs in the original library that have not been carried through here:</p> <ul> <li>strings in subscripts may now be double-quoted</li> <li>final <code>step</code> arguments in slice operators may now be negative</li> <li>script expressions may now contain <code>.</code> and <code>@</code> characters not referring to instance variables</li> <li>subscripts no longer act as character slices on string elements</li> <li>non-ascii non-word characters are no-longer valid in member identifier names; use quoted subscript strings instead (e.g., <code>$[&#39;$&#39;]</code> instead of <code>$.$</code>)</li> <li>unions now yield real unions with no duplicates rather than concatenated results</li> </ul> <a href="#license" id="license" style="color: inherit; text-decoration: none;"> <h2>License</h2> </a> <p><a href="LICENSE">MIT</a></p> </div> </div> <div class="col-4 col-menu menu-sticky-wrap menu-highlight"> <nav class="tsd-navigation primary"> <ul> <li class="globals "> <a href="globals.html"><em>Globals</em></a> </li> </ul> </nav> <nav class="tsd-navigation secondary menu-sticky"> <ul class="before-current"> <li class=" tsd-kind-class"> <a href="classes/jsonpath.html" class="tsd-kind-icon">JSONPath</a> </li> <li class=" tsd-kind-class"> <a href="classes/assert.html" class="tsd-kind-icon">assert</a> </li> <li class=" tsd-kind-variable"> <a href="globals.html#fnexprtokens" class="tsd-kind-icon">Fn<wbr>Expr<wbr>Tokens</a> </li> <li class=" tsd-kind-variable"> <a href="globals.html#messages" class="tsd-kind-icon">Messages</a> </li> <li class=" tsd-kind-variable"> <a href="globals.html#propertykind" class="tsd-kind-icon">Property<wbr>Kind</a> </li> <li class=" tsd-kind-variable"> <a href="globals.html#regex" class="tsd-kind-icon">Regex</a> </li> <li class=" tsd-kind-variable"> <a href="globals.html#syntaxtreedelegate" class="tsd-kind-icon">Syntax<wbr>Tree<wbr>Delegate</a> </li> <li class=" tsd-kind-variable"> <a href="globals.html#token" class="tsd-kind-icon">Token</a> </li> <li class=" tsd-kind-variable"> <a href="globals.html#tokenname" class="tsd-kind-icon">Token<wbr>Name</a> </li> <li class=" tsd-kind-variable"> <a href="globals.html#delegate" class="tsd-kind-icon">delegate</a> </li> <li class=" tsd-kind-variable"> <a href="globals.html#extra" class="tsd-kind-icon">extra</a> </li> <li class=" tsd-kind-variable"> <a href="globals.html#index" class="tsd-kind-icon">index</a> </li> <li class=" tsd-kind-variable"> <a href="globals.html#length" class="tsd-kind-icon">length</a> </li> <li class=" tsd-kind-variable"> <a href="globals.html#linenumber" class="tsd-kind-icon">line<wbr>Number</a> </li> <li class=" tsd-kind-variable"> <a href="globals.html#linestart" class="tsd-kind-icon">line<wbr>Start</a> </li> <li class=" tsd-kind-variable"> <a href="globals.html#lookahead" class="tsd-kind-icon">lookahead</a> </li> <li class=" tsd-kind-variable"> <a href="globals.html#source" class="tsd-kind-icon">source</a> </li> <li class=" tsd-kind-variable"> <a href="globals.html#state" class="tsd-kind-icon">state</a> </li> <li class=" tsd-kind-variable"> <a href="globals.html#strict" class="tsd-kind-icon">strict</a> </li> <li class=" tsd-kind-variable"> <a href="globals.html#version" class="tsd-kind-icon">version</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#position" class="tsd-kind-icon">Position</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#sourcelocation" class="tsd-kind-icon">Source<wbr>Location</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#addcomment" class="tsd-kind-icon">add<wbr>Comment</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#advance" class="tsd-kind-icon">advance</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#advanceslash" class="tsd-kind-icon">advance<wbr>Slash</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#binaryprecedence" class="tsd-kind-icon">binary<wbr>Precedence</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#collectregex" class="tsd-kind-icon">collect<wbr>Regex</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#collecttoken" class="tsd-kind-icon">collect<wbr>Token</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#consumesemicolon" class="tsd-kind-icon">consume<wbr>Semicolon</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#expect" class="tsd-kind-icon">expect</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#expectkeyword" class="tsd-kind-icon">expect<wbr>Keyword</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#filtertokenlocation" class="tsd-kind-icon">filter<wbr>Token<wbr>Location</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#getescapedidentifier" class="tsd-kind-icon">get<wbr>Escaped<wbr>Identifier</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#getidentifier" class="tsd-kind-icon">get<wbr>Identifier</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#isdecimaldigit" class="tsd-kind-icon">is<wbr>Decimal<wbr>Digit</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#isfuturereservedword" class="tsd-kind-icon">is<wbr>Future<wbr>Reserved<wbr>Word</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#ishexdigit" class="tsd-kind-icon">is<wbr>Hex<wbr>Digit</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#isidentifiername" class="tsd-kind-icon">is<wbr>Identifier<wbr>Name</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#isidentifierpart" class="tsd-kind-icon">is<wbr>Identifier<wbr>Part</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#isidentifierstart" class="tsd-kind-icon">is<wbr>Identifier<wbr>Start</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#iskeyword" class="tsd-kind-icon">is<wbr>Keyword</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#islefthandside" class="tsd-kind-icon">is<wbr>Left<wbr>Hand<wbr>Side</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#islineterminator" class="tsd-kind-icon">is<wbr>Line<wbr>Terminator</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#isoctaldigit" class="tsd-kind-icon">is<wbr>Octal<wbr>Digit</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#isrestrictedword" class="tsd-kind-icon">is<wbr>Restricted<wbr>Word</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#isstrictmodereservedword" class="tsd-kind-icon">is<wbr>Strict<wbr>Mode<wbr>Reserved<wbr>Word</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#iswhitespace" class="tsd-kind-icon">is<wbr>White<wbr>Space</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#lex" class="tsd-kind-icon">lex</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#match" class="tsd-kind-icon">match</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#matchassign" class="tsd-kind-icon">match<wbr>Assign</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#matchkeyword" class="tsd-kind-icon">match<wbr>Keyword</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parse" class="tsd-kind-icon">parse</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsearguments" class="tsd-kind-icon">parse<wbr>Arguments</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsearrayinitialiser" class="tsd-kind-icon">parse<wbr>Array<wbr>Initialiser</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parseassignmentexpression" class="tsd-kind-icon">parse<wbr>Assignment<wbr>Expression</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsebinaryexpression" class="tsd-kind-icon">parse<wbr>Binary<wbr>Expression</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parseblock" class="tsd-kind-icon">parse<wbr>Block</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsebreakstatement" class="tsd-kind-icon">parse<wbr>Break<wbr>Statement</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsecatchclause" class="tsd-kind-icon">parse<wbr>Catch<wbr>Clause</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsecomputedmember" class="tsd-kind-icon">parse<wbr>Computed<wbr>Member</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parseconditionalexpression" class="tsd-kind-icon">parse<wbr>Conditional<wbr>Expression</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parseconstletdeclaration" class="tsd-kind-icon">parse<wbr>Const<wbr>Let<wbr>Declaration</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsecontinuestatement" class="tsd-kind-icon">parse<wbr>Continue<wbr>Statement</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsedebuggerstatement" class="tsd-kind-icon">parse<wbr>Debugger<wbr>Statement</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsedowhilestatement" class="tsd-kind-icon">parse<wbr>DoWhile<wbr>Statement</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parseemptystatement" class="tsd-kind-icon">parse<wbr>Empty<wbr>Statement</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parseexpression" class="tsd-kind-icon">parse<wbr>Expression</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parseexpressionstatement" class="tsd-kind-icon">parse<wbr>Expression<wbr>Statement</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parseforstatement" class="tsd-kind-icon">parse<wbr>For<wbr>Statement</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parseforvariabledeclaration" class="tsd-kind-icon">parse<wbr>For<wbr>Variable<wbr>Declaration</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsefunctiondeclaration" class="tsd-kind-icon">parse<wbr>Function<wbr>Declaration</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsefunctionexpression" class="tsd-kind-icon">parse<wbr>Function<wbr>Expression</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsefunctionsourceelements" class="tsd-kind-icon">parse<wbr>Function<wbr>Source<wbr>Elements</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsegroupexpression" class="tsd-kind-icon">parse<wbr>Group<wbr>Expression</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parseifstatement" class="tsd-kind-icon">parse<wbr>IfStatement</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parselefthandsideexpression" class="tsd-kind-icon">parse<wbr>Left<wbr>Hand<wbr>Side<wbr>Expression</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parselefthandsideexpressionallowcall" class="tsd-kind-icon">parse<wbr>Left<wbr>Hand<wbr>Side<wbr>Expression<wbr>Allow<wbr>Call</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsenewexpression" class="tsd-kind-icon">parse<wbr>New<wbr>Expression</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsenoncomputedmember" class="tsd-kind-icon">parse<wbr>Non<wbr>Computed<wbr>Member</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsenoncomputedproperty" class="tsd-kind-icon">parse<wbr>Non<wbr>Computed<wbr>Property</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parseobjectinitialiser" class="tsd-kind-icon">parse<wbr>Object<wbr>Initialiser</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parseobjectproperty" class="tsd-kind-icon">parse<wbr>Object<wbr>Property</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parseobjectpropertykey" class="tsd-kind-icon">parse<wbr>Object<wbr>Property<wbr>Key</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parseparams" class="tsd-kind-icon">parse<wbr>Params</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsepostfixexpression" class="tsd-kind-icon">parse<wbr>Postfix<wbr>Expression</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parseprimaryexpression" class="tsd-kind-icon">parse<wbr>Primary<wbr>Expression</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parseprogram" class="tsd-kind-icon">parse<wbr>Program</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsepropertyfunction" class="tsd-kind-icon">parse<wbr>Property<wbr>Function</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsereturnstatement" class="tsd-kind-icon">parse<wbr>Return<wbr>Statement</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsesourceelement" class="tsd-kind-icon">parse<wbr>Source<wbr>Element</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsesourceelements" class="tsd-kind-icon">parse<wbr>Source<wbr>Elements</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsestatement" class="tsd-kind-icon">parse<wbr>Statement</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsestatementlist" class="tsd-kind-icon">parse<wbr>Statement<wbr>List</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parseswitchcase" class="tsd-kind-icon">parse<wbr>Switch<wbr>Case</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parseswitchstatement" class="tsd-kind-icon">parse<wbr>Switch<wbr>Statement</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsethrowstatement" class="tsd-kind-icon">parse<wbr>Throw<wbr>Statement</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsetrystatement" class="tsd-kind-icon">parse<wbr>Try<wbr>Statement</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parseunaryexpression" class="tsd-kind-icon">parse<wbr>Unary<wbr>Expression</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsevariabledeclaration" class="tsd-kind-icon">parse<wbr>Variable<wbr>Declaration</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsevariabledeclarationlist" class="tsd-kind-icon">parse<wbr>Variable<wbr>Declaration<wbr>List</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsevariableidentifier" class="tsd-kind-icon">parse<wbr>Variable<wbr>Identifier</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsevariablestatement" class="tsd-kind-icon">parse<wbr>Variable<wbr>Statement</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsewhilestatement" class="tsd-kind-icon">parse<wbr>While<wbr>Statement</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#parsewithstatement" class="tsd-kind-icon">parse<wbr>With<wbr>Statement</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#peek" class="tsd-kind-icon">peek</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#peeklineterminator" class="tsd-kind-icon">peek<wbr>Line<wbr>Terminator</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#scanhexescape" class="tsd-kind-icon">scan<wbr>Hex<wbr>Escape</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#scanhexliteral" class="tsd-kind-icon">scan<wbr>Hex<wbr>Literal</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#scanidentifier" class="tsd-kind-icon">scan<wbr>Identifier</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#scannumericliteral" class="tsd-kind-icon">scan<wbr>Numeric<wbr>Literal</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#scanoctalliteral" class="tsd-kind-icon">scan<wbr>Octal<wbr>Literal</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#scanpunctuator" class="tsd-kind-icon">scan<wbr>Punctuator</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#scanregexp" class="tsd-kind-icon">scan<wbr>Reg<wbr>Exp</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#scanregexpbody" class="tsd-kind-icon">scan<wbr>Reg<wbr>Exp<wbr>Body</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#scanregexpflags" class="tsd-kind-icon">scan<wbr>Reg<wbr>Exp<wbr>Flags</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#scanstringliteral" class="tsd-kind-icon">scan<wbr>String<wbr>Literal</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#skipcomment" class="tsd-kind-icon">skip<wbr>Comment</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#skipmultilinecomment" class="tsd-kind-icon">skip<wbr>Multi<wbr>Line<wbr>Comment</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#skipsinglelinecomment" class="tsd-kind-icon">skip<wbr>Single<wbr>Line<wbr>Comment</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#testregexp" class="tsd-kind-icon">test<wbr>Reg<wbr>Exp</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#throwerror" class="tsd-kind-icon">throw<wbr>Error</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#throwerrortolerant" class="tsd-kind-icon">throw<wbr>Error<wbr>Tolerant</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#throwunexpected" class="tsd-kind-icon">throw<wbr>Unexpected</a> </li> <li class=" tsd-kind-function"> <a href="globals.html#tokenize" class="tsd-kind-icon">tokenize</a> </li> <li class=" tsd-kind-function tsd-has-type-parameter"> <a href="globals.html#uniq" class="tsd-kind-icon">uniq</a> </li> <li class=" tsd-kind-object-literal"> <a href="globals.html#syntax" class="tsd-kind-icon">Syntax</a> </li> </ul> </nav> </div> </div> </div> <footer class="with-border-bottom"> <div class="container"> <h2>Legend</h2> <div class="tsd-legend-group"> <ul class="tsd-legend"> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li> </ul> </div> </div> </footer> <div class="container tsd-generator"> <p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p> </div> <div class="overlay"></div> <script src="assets/js/main.js"></script> <script>if (location.protocol == 'file:') document.write('<script src="assets/js/search.js"><' + '/script>');</script> </body> </html>