@andymenderunix/jisho-js
Version:
JavaScript wrapper around the jisho.org search Web API.
2,470 lines (649 loc) • 26 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Global</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-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<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="execute_query"><span class="type-signature">(async) </span>execute_query<span class="signature">(query_blocks)</span><span class="type-signature"> → {Array}</span></h4>
<div class="description">
[execute_query Core function to get results from the Jisho API]
</div>
<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>query_blocks</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last">[Query words to send to the API]</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line151">line 151</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
[Array of jisho results objects]
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id="extractJishoData"><span class="type-signature">(async) </span>extractJishoData<span class="signature">(response_json)</span><span class="type-signature"> → {Array}</span></h4>
<div class="description">
[extractJishoData Converts Jisho API response records into JishoRecord entries]
</div>
<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>response_json</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last">[array of records in a Jisho API response]</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line248">line 248</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
[array of JishoRecord Objects]
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id="extractJLPTLevel"><span class="type-signature"></span>extractJLPTLevel<span class="signature">(entry)</span><span class="type-signature"> → {string}</span></h4>
<div class="description">
[extractJLPTLevel Extract the JLPT level from a Jisho API response record]
</div>
<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>entry</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">[record in a Jisho API response]</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line180">line 180</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
[JLPT level in the format 'Nx']
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="extractMeanings"><span class="type-signature"></span>extractMeanings<span class="signature">(entry)</span><span class="type-signature"> → {Array}</span></h4>
<div class="description">
[extractMeanings Extract a word's meanings from a Jisho API response record]
</div>
<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>entry</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">[record in a Jisho API response]</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line215">line 215</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
[array of unique word meanings]
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id="extractReading"><span class="type-signature"></span>extractReading<span class="signature">(entry)</span><span class="type-signature"> → {string}</span></h4>
<div class="description">
[extractReading Extract the word reading from a Jisho API response record]
</div>
<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>entry</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">[record in a Jisho API response]</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line205">line 205</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
[reading]
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="extractWaniKaniLevel"><span class="type-signature"></span>extractWaniKaniLevel<span class="signature">(entry)</span><span class="type-signature"> → {string}</span></h4>
<div class="description">
[extractWaniKaniLevel Extract the WaniKani level from a Jisho API response record]
</div>
<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>entry</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">[record in a Jisho API response]</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line193">line 193</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
[WaniKani level]
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">string</span>
</dd>
</dl>
<h4 class="name" id="extractWordTypes"><span class="type-signature"></span>extractWordTypes<span class="signature">(entry)</span><span class="type-signature"> → {Array}</span></h4>
<div class="description">
[extractWordTypes Extract a word's grammatical types from a Jisho API response record]
</div>
<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>entry</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">[record in a Jisho API response]</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line231">line 231</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
[array of unique word grammatical types]
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id="getCommonEntries"><span class="type-signature">(async) </span>getCommonEntries<span class="signature">(query)</span><span class="type-signature"> → {Array}</span></h4>
<div class="description">
[getCommonEntries Get only common entries for a given query]
</div>
<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>query</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">[Query word to send to the API]</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line71">line 71</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
[Array of JishoRecord objects]
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id="getEntries"><span class="type-signature">(async) </span>getEntries<span class="signature">(query, is_commmon)</span><span class="type-signature"> → {Array}</span></h4>
<div class="description">
[getEntries Gets records from the Jisho Web API]
</div>
<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>query</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">[Query word to send to the API]</td>
</tr>
<tr>
<td class="name"><code>is_commmon</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last">[Flag to query for common vocabulary]</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line51">line 51</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
[Array of JishoRecord objects]
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id="getEntriesEndingWith"><span class="type-signature">(async) </span>getEntriesEndingWith<span class="signature">(query, is_commmon)</span><span class="type-signature"> → {Array}</span></h4>
<div class="description">
[getEntriesEndingWith Get results for a word ending with a given query]
</div>
<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>query</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">[Query word to send to the API]</td>
</tr>
<tr>
<td class="name"><code>is_commmon</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last">[Flag to query for common vocabulary]</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line96">line 96</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
[Array of JishoRecord objects]
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id="getEntriesJLPTLevel"><span class="type-signature">(async) </span>getEntriesJLPTLevel<span class="signature">(query, jlpt_level)</span><span class="type-signature"> → {Array}</span></h4>
<div class="description">
[getEntriesJLPTLevel Get results for a given JLPT level]
</div>
<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>query</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">[Query word to send to the API]</td>
</tr>
<tr>
<td class="name"><code>jlpt_level</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">[JLPT level in the Nx or nx format]</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line110">line 110</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
[Array of JishoRecord objects]
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id="getEntriesStartingWith"><span class="type-signature">(async) </span>getEntriesStartingWith<span class="signature">(query, is_commmon)</span><span class="type-signature"> → {Array}</span></h4>
<div class="description">
[getEntriesStartingWith Get results for a word starting with a given query]
</div>
<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>query</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">[Query word to send to the API]</td>
</tr>
<tr>
<td class="name"><code>is_commmon</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last">[Flag to query for common vocabulary]</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line82">line 82</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
[Array of JishoRecord objects]
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id="getEntriesWasei"><span class="type-signature">(async) </span>getEntriesWasei<span class="signature">(query, is_commmon)</span><span class="type-signature"> → {Array}</span></h4>
<div class="description">
[getEntriesWasei Get wasei eigo results for a given query]
</div>
<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>query</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">[Query word to send to the API]</td>
</tr>
<tr>
<td class="name"><code>is_commmon</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last">[Flag to query for common vocabulary]</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line131">line 131</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
[Array of JishoRecord objects]
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
<h4 class="name" id="JishoRecord"><span class="type-signature"></span>JishoRecord<span class="signature">(entry)</span><span class="type-signature"> → {Object}</span></h4>
<div class="description">
[JishoRecord Converts an entry from the Jisho Web API into a simplified form]
</div>
<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>entry</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">[Entry from the Jisho Web API]</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line30">line 30</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
[Array of jisho results objects]
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Object</span>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#execute_query">execute_query</a></li><li><a href="global.html#extractJishoData">extractJishoData</a></li><li><a href="global.html#extractJLPTLevel">extractJLPTLevel</a></li><li><a href="global.html#extractMeanings">extractMeanings</a></li><li><a href="global.html#extractReading">extractReading</a></li><li><a href="global.html#extractWaniKaniLevel">extractWaniKaniLevel</a></li><li><a href="global.html#extractWordTypes">extractWordTypes</a></li><li><a href="global.html#getCommonEntries">getCommonEntries</a></li><li><a href="global.html#getEntries">getEntries</a></li><li><a href="global.html#getEntriesEndingWith">getEntriesEndingWith</a></li><li><a href="global.html#getEntriesJLPTLevel">getEntriesJLPTLevel</a></li><li><a href="global.html#getEntriesStartingWith">getEntriesStartingWith</a></li><li><a href="global.html#getEntriesWasei">getEntriesWasei</a></li><li><a href="global.html#JishoRecord">JishoRecord</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Sun Jul 23 2023 12:57:23 GMT+0200 (Central European Summer Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>