fca-nazrul-remastered
Version:
Facebook-chat-api protect and deploy by Kanzu and HZI Team
17 lines (13 loc) • 600 B
JavaScript
;
const utils = require("../utils");
module.exports = function (defaultFuncs, api, ctx) {
return function addExternalModule(moduleObj) {
if (utils.getType(moduleObj) == "Object") {
for (let apiName in moduleObj) {
if (utils.getType(moduleObj[apiName]) == "Function") api[apiName] = moduleObj[apiName](defaultFuncs, api, ctx);
else throw new Error(`Item "${apiName}" in moduleObj must be a function, not ${utils.getType(moduleObj[apiName])}!`);
}
}
else throw new Error(`moduleObj must be an object, not ${utils.getType(moduleObj)}!`);
};
};