pybuiltinfunc
Version:
Python built-in Functions and Modules in Javascript
34 lines • 751 B
JavaScript
const ifloop = (condition="", anony = () => {}) => {
const eqRegex = /==/;
const uneqRegex = /==/;
const addRegex = /and/;
const orRegex = /or/;
if(eqRegex.test(condition)){
condition.replace('==', '===')
}
if(uneqRegex.test(condition)){
condition.replace('!=', '===')
}
if (condition) {
anony();
}
};
const ifElseLoop = (condition, anony = () => {}, nega = () => {}) => {
const eqRegex = /==/;
const uneqRegex = /==/;
if(eqRegex.test(condition)){
condition.replace('==', '===')
}
if(uneqRegex.test(condition)){
condition.replace('!=', '===')
}
if (condition) {
anony();
} else {
nega();
}
}
module.exports.loop = {
if: ifloop,
ifesle: ifElseLoop
}