docs/index.html
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>kitai</title>
<meta name="description" content="Documentation for kitai">
<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">kitai</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>kitai</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<div class="tsd-panel tsd-typography">
<p><a href="https://discord.gg/p895czC"><img src="https://discordapp.com/api/guilds/240059867744698368/embed.png" alt="Discord"></a>
<a href="https://www.npmjs.com/package/@pepijn98/kitai"><img src="https://img.shields.io/npm/v/@pepijn98/kitai.svg?maxAge=3600" alt="Version"></a>
<a href="https://www.npmjs.com/package/@pepijn98/kitai"><img src="https://img.shields.io/npm/dt/@pepijn98/kitai.svg?maxAge=3600" alt="Downloads"></a>
<a href="https://david-dm.org/Pepijn98/kitai"><img src="https://img.shields.io/david/Pepijn98/kitai.svg?maxAge=3600" alt="Dependencies"></a>
<a href="https://david-dm.org/Pepijn98/kitai"><img src="https://img.shields.io/david/dev/Pepijn98/kitai.svg?maxAge=3600" alt="Dev Dependencies"></a>
<a href="https://codeclimate.com/github/Pepijn98/kitai/maintainability"><img src="https://api.codeclimate.com/v1/badges/843becfdf91e15da5b0c/maintainability" alt="Maintainability"></a></p>
<a href="#kitai-期待" id="kitai-期待" style="color: inherit; text-decoration: none;">
<h1>kitai (期待)</h1>
</a>
<p>This is a copy of kotlin's require function.
<br>
It validates the condition you give it and if it's false will throw an IllegalArgumentException.</p>
<a href="#installation" id="installation" style="color: inherit; text-decoration: none;">
<h1>Installation</h1>
</a>
<ul>
<li>npm i -S @pepijn98/kitai</li>
<li>yarn add @pepijn98/kitai</li>
</ul>
<a href="#examples" id="examples" style="color: inherit; text-decoration: none;">
<h1>Examples</h1>
</a>
<p>See <a href="./examples">examples</a> for more</p>
<pre><code class="language-ts"><span class="hljs-comment">// You can name this anything you want, I like "expect" since it fits the package name.</span>
<span class="hljs-comment">// You can even name it require just like kotlin (only if you don't use node's require function)</span>
<span class="hljs-keyword">import</span> expect <span class="hljs-keyword">from</span> <span class="hljs-string">"@pepijn98/kitai"</span>;
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">test</span>(<span class="hljs-params">arg: <span class="hljs-built_in">number</span></span>): <span class="hljs-title">void</span> </span>{
expect(arg >= <span class="hljs-number">0</span>, <span class="hljs-function">() =></span> <span class="hljs-string">`"arg" cannot be a negative number, was <span class="hljs-subst">${arg}</span>`</span>);
<span class="hljs-comment">// We now know that arg will not be a negative number</span>
<span class="hljs-comment">// Do your extremly complex 9000 IQ mathematical equation here</span>
}
test(-<span class="hljs-number">5</span>); <span class="hljs-comment">// Will throw an IllegalArgumentException</span>
test(<span class="hljs-number">15</span>); <span class="hljs-comment">// Won't throw, yaay</span></code></pre>
<a href="#name" id="name" style="color: inherit; text-decoration: none;">
<h1>Name</h1>
</a>
<p>Since it's a Japanese name I guess I should explain this, even though I don't speak Japanese and use translators.
<br>
Kitai written as 期待 in kanji, roughly means "Expectations" or "Expectation"
<br>
<br>
<em>(directly taken from google translate and deepl, please excuse my ignorance if it's completly wrong)</em></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/illegalargumentexception.html" class="tsd-kind-icon">Illegal<wbr>Argument<wbr>Exception</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-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li>
</ul>
<ul class="tsd-legend">
<li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</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>
</body>
</html>