helpers.functions - ZeMA-gGmbH/NoPE-JS GitHub Wiki

Namespace: functions

helpers.functions

Functions

_extractArgumentsPartFromFunction

_extractArgumentsPartFromFunction(func): string

Helper to extrat the code of the function:

Example

function func(betterMakeSure, itWorksWith, longVariables = 'too') {}

const r = extractArgumentsPartFromFunction(func);

// => r  = (betterMakeSure,itWorksWith,longVariables='too')

Parameters

Name Type
func any

Returns

string


countAllArguments

countAllArguments(func): number

Helper to count all arguments of an function (including the optional ones.)

Parameters

Name Type Description
func any The function, where we want to count the parameters

Returns

number


countArguments

countArguments(func): Object

Helper to count the arguments.

Parameters

Name Type Description
func any The function ot be analysed

Returns

Object

Name Type
optional number
static number
total number

fillOptionalArguments

fillOptionalArguments(func, providedArg, argsToFill, fromEnd?): any[]

Helper to fill provided arguments for the function.

Parameters

Name Type Default value Description
func any undefined The function ot be analysed
providedArg any[] undefined The allready provided args
argsToFill any[] undefined The Arguments to fill
fromEnd boolean true A Flag to toggle, whether the arguments should be filled from the end or the beginning.

Returns

any[]