so Hi people
we always in a way's finish sometime to write our own method in a ways for simplify our jobs reduce number of workload?
in simple method who just simplify your life as coder.
For being a human minded type coder I don't like enter in compact or unreadable coding.
but also as being a lazy guy...I don't like having to repeat code each time.
So let's say...I prefer creating something who will auto do the job for me :3
ANYWAYS here a pure example of code I done for my own core because simple as f*ck for me!
Emoji_Engine.prototype.setNumber = function(Plugin_var,ParamName,type,max_number) { var number = Number(Plugin_var[ParamName]); var final_result = null; switch (type.toLowerCase()){ // get the regular number. default : final_result = number; break; // get the low round case 'floor' : final_result = Math.floor(number); break; // get the uppest round. case 'ceil' : final_result = Math.ceil(number); break; case 'round' : // round to the nearest value. final_result = Math.round(number); break; case 'topercent' : // convert number to percent. final_result = (number / max_number) * 100; break; // convert the percent in float number. case 'todecimal' : final_result = (number / 100) * max_number; break; // convert your number into a PI math value. case 'topi' : final_result = Math.PI(number); break; // return the absolute values of the number. case 'abs' : final_result = Math.abs(number); }return final_result;};this one permit to convert Plugin Param straight to what I want with easy use. because #lazy
the second one I totally prefer because I don't like doing stuff likes :
this.param = boolean(this.pluginName['pluginparam'] === 'true' || false);so I do this kind of method it's not the best optimized but it's do the job and it's also make sure people don't do the error to miss-write false or true in the plugin manager and to arrive and saying : Ur script is buggy !
Emoji_Engine.prototype.setBoolean = function(Plugin_var,ParamName) { var n = Plugin_var[ParamName]; var s = undefined; if(n === "true" || n === "false"){ if(n === "true"){ s = true; } else { s = false; } } else{ throw new Error(ParamName + " is a boolean please set it to true or false"); }return s;};May people think my stuff are not optimized but I will being honest : I don't really care lol
for me I prefer having readable coding than a compacted stuff I can't read.
Anyways
What's about you guys what's are your own "functional" method you create for just....reduce your workload o3o?
we always in a way's finish sometime to write our own method in a ways for simplify our jobs reduce number of workload?
in simple method who just simplify your life as coder.
For being a human minded type coder I don't like enter in compact or unreadable coding.
but also as being a lazy guy...I don't like having to repeat code each time.
So let's say...I prefer creating something who will auto do the job for me :3
ANYWAYS here a pure example of code I done for my own core because simple as f*ck for me!
Emoji_Engine.prototype.setNumber = function(Plugin_var,ParamName,type,max_number) { var number = Number(Plugin_var[ParamName]); var final_result = null; switch (type.toLowerCase()){ // get the regular number. default : final_result = number; break; // get the low round case 'floor' : final_result = Math.floor(number); break; // get the uppest round. case 'ceil' : final_result = Math.ceil(number); break; case 'round' : // round to the nearest value. final_result = Math.round(number); break; case 'topercent' : // convert number to percent. final_result = (number / max_number) * 100; break; // convert the percent in float number. case 'todecimal' : final_result = (number / 100) * max_number; break; // convert your number into a PI math value. case 'topi' : final_result = Math.PI(number); break; // return the absolute values of the number. case 'abs' : final_result = Math.abs(number); }return final_result;};this one permit to convert Plugin Param straight to what I want with easy use. because #lazy
the second one I totally prefer because I don't like doing stuff likes :
this.param = boolean(this.pluginName['pluginparam'] === 'true' || false);so I do this kind of method it's not the best optimized but it's do the job and it's also make sure people don't do the error to miss-write false or true in the plugin manager and to arrive and saying : Ur script is buggy !
Emoji_Engine.prototype.setBoolean = function(Plugin_var,ParamName) { var n = Plugin_var[ParamName]; var s = undefined; if(n === "true" || n === "false"){ if(n === "true"){ s = true; } else { s = false; } } else{ throw new Error(ParamName + " is a boolean please set it to true or false"); }return s;};May people think my stuff are not optimized but I will being honest : I don't really care lol
for me I prefer having readable coding than a compacted stuff I can't read.
Anyways
What's about you guys what's are your own "functional" method you create for just....reduce your workload o3o?