-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathrecord.js.html
132 lines (104 loc) · 3.23 KB
/
record.js.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: record.js</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">Source: record.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>"use strict";
/**
* Hold a query record
*/
class Record {
/**
* Builds a Record object
*
* @param {string[]} header
* @param {object[]} values
*/
constructor(header, values) {
this._header = header;
this._values = values;
}
/**
* Returns a value of the given schema key or in the given position.
* @param {string | number} key (integer)
* @returns {object} Requested value.
*/
get(key) {
let index = key;
if (typeof key === "string") {
index = this._header.indexOf(key);
}
return this._values[index];
}
/**
* Returns a string representation for the value of the given schema key or in the given position.
* @param {string | number} key (integer)
* @returns {string} Requested string representation of the value.
*/
getString(key) {
let index = key;
if (typeof key === "string") {
index = this._header.indexOf(key);
}
let value = this._values[index];
if (value !== undefined && value !== null) {
return value.toString();
}
return null;
}
/**
* @returns {string[]} The record header - List of strings.
*/
keys() {
return this._header;
}
/**
* @returns {object[]} The record values - List of values.
*/
values() {
return this._values;
}
/**
* Returns if the header contains a given key.
* @param {string} key
* @returns {boolean} true if header contains key.
*/
containsKey(key) {
return this._header.includes(key);
}
/**
* @returns {number} The amount of values in the record. (integer)
*/
size() {
return this._header.length;
}
}
module.exports = Record;
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Edge.html">Edge</a></li><li><a href="Graph.html">Graph</a></li><li><a href="Node.html">Node</a></li><li><a href="Path.html">Path</a></li><li><a href="Record.html">Record</a></li><li><a href="ResultSet.html">ResultSet</a></li><li><a href="Statistics.html">Statistics</a></li></ul><h3>Global</h3><ul><li><a href="global.html#Label">Label</a></li><li><a href="global.html#ResultSetColumnTypes">ResultSetColumnTypes</a></li><li><a href="global.html#ResultSetValueTypes">ResultSetValueTypes</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Thu Dec 08 2022 09:52:52 GMT+0000 (Coordinated Universal Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>