sussy-util
Version:
Util package made by me
19 lines (18 loc) • 749 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const IsSomething_1 = __importDefault(require("../Classes/IsSomething"));
/**
* Calls the given function with the provided parameters if it is a valid function.
*
* @param {any} func - The function to call.
* @param {...any} params - The parameters to pass to the function.
* @returns {any|null} The result of the function call or null if the provided func is not a valid function.
*/
exports.default = (func, ...params) => {
if (!IsSomething_1.default.isFunction(func))
return null;
return func(...params);
};