1 | <!doctype html>
|
2 | <html>
|
3 |
|
4 | <head>
|
5 | <meta name="generator" content="JSDoc 3.6.2">
|
6 | <meta charset="utf-8">
|
7 | <title>keyu 2.0.0 » Source: types/index.js</title>
|
8 | <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
|
9 | <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
|
10 | <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
|
11 | <link href="css/baseline.css" rel="stylesheet">
|
12 | </head>
|
13 |
|
14 | <body onload="prettyPrint()">
|
15 | <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
|
16 | <div id="jsdoc-navbar-container">
|
17 | <div id="jsdoc-navbar-content">
|
18 | <a href="index.html" class="jsdoc-navbar-package-name">keyu 2.<wbr>0.<wbr>0</a>
|
19 | </div>
|
20 | </div>
|
21 | </nav>
|
22 | <div id="jsdoc-body-container">
|
23 | <div id="jsdoc-content">
|
24 | <div id="jsdoc-content-container">
|
25 | <div id="jsdoc-banner" role="banner">
|
26 | </div>
|
27 | <div id="jsdoc-main" role="main">
|
28 | <header class="page-header">
|
29 | <h1>Source: types/index.js</h1>
|
30 | </header>
|
31 | <article>
|
32 | <pre class="prettyprint linenums"><code>/** @module types */
|
33 |
|
34 | /** Checks **correctly** if the passed type is or not a **number**
|
35 | * @argument {*} num any possible data type
|
36 | * @returns {boolean} indicating if is a number or not
|
37 | * @example
|
38 | * isNumber(null) // -> false note isNaN(null) will return false instead
|
39 | * @see [typesTest.js](https://github.com/nerac/keyu/blob/master/test/typesTest.js)
|
40 | * @method
|
41 | */
|
42 | const isNumber = num => !isNaN(num) &amp;&amp; num !== null;
|
43 |
|
44 | /** Checks **correctly** if the passed type is or not an **object**
|
45 | * @argument {*} num any possible data type
|
46 | * @returns {boolean} indicating if it's an object or not
|
47 | * @example
|
48 | * isObject(null) // -> false note that typeof will return true
|
49 | * isObject({}) // -> true
|
50 | * isObject(new Error()) // -> true
|
51 | * @see [typesTest.js](https://github.com/nerac/keyu/blob/master/test/typesTest.js)
|
52 | * @method
|
53 | */
|
54 | const isObject = obj => typeof obj === 'object' &amp;&amp; !Array.isArray(obj) &amp;&amp; obj !== null;
|
55 |
|
56 | /** Checks if the passed type is a non defined value, either `undefined` or `null`
|
57 | * @argument {*} num any possible data type
|
58 | * @returns {boolean} indicating if it's an non defined
|
59 | * @example
|
60 | * isNil(null) // -> true
|
61 | * isNil(3) // -> false
|
62 | * isNil() // -> true
|
63 | * isNil(undefined) // -> true
|
64 | * @see [typesTest.js](https://github.com/nerac/keyu/blob/master/test/typesTest.js)
|
65 | * @method
|
66 | */
|
67 | const isNil = value => typeof value === 'undefined' || value === null;
|
68 |
|
69 | /** Returns the name of the function in which is called.
|
70 | * @argument {String} [defaultValue] string for unknown calls.
|
71 | * @returns {String} indicating the possible name of the function
|
72 | * @example
|
73 | * const hello = () => getFuncName()
|
74 | * hello() // -> "hello"
|
75 | * getFuncName() // -> "Unknown"
|
76 | * getFuncName("ups") // -> "ups"
|
77 | * @see [typesTest.js](https://github.com/nerac/keyu/blob/master/test/typesTest.js)
|
78 | * @method
|
79 | */
|
80 | function getFuncName(defaultValue = 'Unknown') {
|
81 | return (getFuncName.caller &amp;&amp; getFuncName.caller.name) || defaultValue;
|
82 | }
|
83 |
|
84 | module.exports = { isNumber, isObject, isNil, getFuncName };
|
85 | </code></pre>
|
86 | </article>
|
87 | </div>
|
88 | </div>
|
89 | <nav id="jsdoc-toc-nav" role="navigation"></nav>
|
90 | </div>
|
91 | </div>
|
92 | <footer id="jsdoc-footer" class="jsdoc-footer">
|
93 | <div id="jsdoc-footer-container">
|
94 | <p>
|
95 | Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc</a> 3.6.2 on June 17, 2019.
|
96 | </p>
|
97 | </div>
|
98 | </footer>
|
99 | <script src="scripts/jquery.min.js"></script>
|
100 | <script src="scripts/jquery.cookie.js"></script>
|
101 | <script src="scripts/tree.jquery.js"></script>
|
102 | <script src="scripts/prettify.js"></script>
|
103 | <script src="scripts/jsdoc-toc.js"></script>
|
104 | <script src="scripts/linenumber.js"></script>
|
105 | <script src="scripts/scrollanchor.js"></script>
|
106 | </body>
|
107 |
|
108 | </html> |
\ | No newline at end of file |