11
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+ */
28function a_plus_b ( a , b ) {
39 return a + b ;
410}
511
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+ */
620const compare = function ( keymap , a , b ) {
721 if ( a [ keymap ] < b [ keymap ] ) {
822 return - 1 ;
@@ -13,6 +27,13 @@ const compare = function (keymap, a, b) {
1327 }
1428}
1529
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+ */
1637const sqlite = ( db , query , callback ) => {
1738 db . serialize ( function ( ) {
1839 db . each ( query , callback ) ;
0 commit comments