Functions

Some functions for if you are using better-MySQL!

I suggest to only use those functions if you are also using the package main intention.

First, let's get the main function object. In this object there are different functions. You can get this object with this code.

const betterMysql = require("better-mysql");
let functions = betterMysql.function;
// The functions are now in the "functions" variable!

isArray

If you want to test if a object is a array, use this function. You don't have to use await and it returns a boolean (true/false).

let array = ["Hi", "Bye"];
console.log(functions.isArray(array)); // Returns "true".

isClass

Now, if you want to test if a object is a class (it can't be a object where the class constructor is already called). You don't have to use await and it returns a boolean (true/false).

let betterMysqlClientClass = require("better-mysql").client;
console.log(functions.isClass(betterMysqlClientClass)); // Returns "true".

isFunctionOfClass

If you want to to check if a object is a class, add this to every class.

check() {
    return true;
}

Last updated