UNPKG

easy-api.ts

Version:

A powerful library to create your own API with ease.

1 lines 1.18 kB
Object.defineProperty(exports,"__esModule",{value:!0});let tslib_1=require("tslib"),APIFunction_1=require("../../classes/structures/APIFunction"),stmt_1=tslib_1.__importDefault(require("../core/stmt")),Error_1=require("../../classes/structures/Error"),Util_1=require("../../classes/internal/Util");class ElseIf extends APIFunction_1.APIFunction{name="$elseif";description="else if statement.";parameters=[{name:"Condition",description:"The condition to be evaluated.",type:APIFunction_1.ParamType.String,required:!0,rest:!1,defaultValue:null},{name:"Then code",description:"Code to execute if the condition is met.",type:APIFunction_1.ParamType.String,required:!0,rest:!1,defaultValue:null}];usage="$elseif[condition;then]";returns=APIFunction_1.ParamType.Unknown;compile=!1;aliases=[];parent=new stmt_1.default;async run(e,[t,r]){var n=(e=e.getInternalVar("eats:if_statement"))[0];if(0===e.length)throw new Error_1.EATS_Error("Invalid statement, you must place an $if at start.");if(!/\$if/gi.test(n.name))throw new Error_1.EATS_Error("Invalid statement, you must place an $if at start.");e.push({name:"$elseif_"+Util_1.Util.hash(),condition:t,code:r})}}exports.default=ElseIf;