index.js
function count() {
    let tableName = arguments[0]
    let callback
    if (arguments.length === 2) {
        callback = arguments[1]
        getAll(tableName, (succ, data) => {
            if (succ) {
                callback(true, data.length)
                return
            } else {
                callback(false, data)
                return
            }
        })
    } else if (arguments.length === 3) {
        callback = arguments[2]
        getAll(tableName, arguments[1], (succ, data) => {
            if (succ) {
                callback(true, data.length)
                return
            } else {
                callback(false, data)
                return
            }
        })
    } else {
        callback(false,'Wrong number of arguments. Must be either 2 or 3 arguments including callback function.')
        return
    }
}
function count() {
    let tableName = arguments[0]
    let callback
    if (arguments.length === 2) {
        callback = arguments[1]
        getAll(tableName, (succ, data) => {
            if (succ) {
                callback(true, data.length)
                return
            } else {
                callback(false, data)
                return
            }
        })
    } else if (arguments.length === 3) {
        callback = arguments[2]
        getAll(tableName, arguments[1], (succ, data) => {
            if (succ) {
                callback(true, data.length)
                return
            } else {
                callback(false, data)
                return
            }
        })
    } else {
        callback(false,'Wrong number of arguments. Must be either 2 or 3 arguments including callback function.')
        return
    }
}
function count ( ) { let tableName = arguments [ 0 ] let callback if ( arguments . length === 2 ) { callback = arguments [ 1 ] getAll ( tableName , ( succ , data ) => { if ( succ ) { callback ( true , data . length ) return } else { callback ( false , data ) return } } ) } else if ( arguments . length === 3 ) { callback = arguments [ 2 ] getAll ( tableName , arguments [ 1 ] , ( succ , data ) => { if ( succ ) { callback ( true , data . length ) return } else { callback ( false , data ) return } } ) } else { callback ( false , 'Wrong number of arguments. Must be either 2 or 3 arguments including callback function.' ) return } }
Count the number of rows for a given table.
@param {string} FirstArgument Table name
@param {string} SecondArgument Location of the database file (Optional)
@param {callback} ThirdArgument Function callback
Count the number of rows for a given table .