11
2+ /**
3+ * Computes the sum of two numbers.
4+ * @param {number } a - The first number to add.
5+ * @param {number } b - The second number to add.
6+ * @returns {number } The sum of the two input numbers.
7+ */
28function a_plus_b ( a , b ) {
39 return a + b ;
410}
511
12+ /**
13+ * Compares two objects based on a specific key and returns an integer based on their relative order.
14+ * @param {string } keymap - The key in the objects `a` and `b` to compare values on.
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[keymap]` is less than `b[keymap]`,
18+ * 1 if it is greater, and 0 if they are equal.
19+ */
620const compare = function ( keymap , a , b ) {
721 if ( a [ keymap ] < b [ keymap ] ) {
822 return - 1 ;
@@ -13,6 +27,18 @@ const compare = function (keymap, a, b) {
1327 }
1428}
1529
30+ /**
31+ * Executes a given SQL query on a database using the `serialize` method to ensure
32+ * that the queries are executed sequentially. The `each` function iterates over
33+ * each row of the result set, invoking the callback provided for each row.
34+ *
35+ * @param {Object } db - The SQLite database object to operate on.
36+ * @param {string } query - The SQL query string to be executed.
37+ * @param {function } callback - A callback function that is executed for each row
38+ * returned by the query. It typically handles the
39+ * row data.
40+ * @returns {void } Does not return a value.
41+ */
1642const sqlite = ( db , query , callback ) => {
1743 db . serialize ( function ( ) {
1844 db . each ( query , callback ) ;
0 commit comments