show your "functionnal" method

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?
My whole core script is created with 'functional' methods... That is the point of a core script after all - to create common use methods to save time overall. 🙂
I don't like functional programming. I get its benefits but it seems more of a mess and more of a hassle then regular OO programming which I am a hug fan of. Ive done functional programming for work and side projects so I am well versed in it, but I feel languages like rust are the proper place for functional programming. While JS is arguably more functional then OO based, I still prefer writing (in es6) classes and inheritance.
My whole core script is created with 'functional' methods... That is the point of a core script after all - to create common use methods to save time overall. 🙂
yeah that's the point of what I wanted to do! 

my core is for purpose done for shortening people workload and my workload as well c: 

one method ramiro showed me how to do is this one ! 

Emoji_Engine.prototype.setArray = function (Plugin_var,ParamName) { return Plugin_var[ParamName].split(',').map( function (i) { return Number(i || 0); } );};the only bad point is the fact it's only for number but I could change this by setting a second array for make string's too even if for the moment it's not needed

the use of this function is to create a array from the param 

so doing this in the plugin editor :

paramcommand 1,2,3will become this in system : 

Code:
[1,2,3];

Original thread: https://forums.rpgmakerweb.com/threads/show-your-functionnal-method.50025/