@onurege3467/zerohelper
Version:
ZeroHelper is a versatile JavaScript library offering helper functions and database utilities for developers. It supports MongoDB, MySQL, SQLite, Redis, and PostgreSQL.
17 lines (13 loc) • 490 B
JavaScript
;
const errors = require("../errors/strings.js");
module.exports = async function (table = "default") {
if (!table || typeof table !== "string")
throw new TypeError(errors.table.replace("{received}", typeof table));
let tables = await this.tables();
if (!tables.includes(table)) return false;
let all = await this.all(table);
if (!all.length) return false;
await this.drop(table, true);
this.emit("tableClear", table);
return this.create(table, true);
};