1
1
2
+ /**
3
+ * Computes the sum of two numbers.
4
+ * @param {number } a - The first number.
5
+ * @param {number } b - The second number.
6
+ * @returns {number } The sum of the two numbers.
7
+ */
2
8
function a_plus_b ( a , b ) {
3
9
return a + b ;
4
10
}
5
11
12
+ /**
13
+ * Compares two objects based on the value associated with a given key.
14
+ * @param {String } keymap - The key name to be used for comparison.
15
+ * @param {Object } a - The first object to compare.
16
+ * @param {Object } b - The second object to compare.
17
+ * @returns {Number } - Returns -1 if the value of 'a' is less than the value of 'b',
18
+ * 1 if greater, or 0 if they are equal.
19
+ */
6
20
const compare = function ( keymap , a , b ) {
7
21
if ( a [ keymap ] < b [ keymap ] ) {
8
22
return - 1 ;
@@ -13,6 +27,13 @@ const compare = function (keymap, a, b) {
13
27
}
14
28
}
15
29
30
+ /**
31
+ * Executes a query on a given SQLite database and applies a callback function to each result row.
32
+ * @param {Object } db - The SQLite database object to be queried.
33
+ * @param {string } query - The SQL query string to be executed on the database.
34
+ * @param {Function } callback - A function that will be called with each row of the result set.
35
+ * @returns {void }
36
+ */
16
37
const sqlite = ( db , query , callback ) => {
17
38
db . serialize ( function ( ) {
18
39
db . each ( query , callback ) ;
0 commit comments