Following cPanel UAPI function store_filter I need to call function with a iterated params if there is more than one rule or action, like:
- action1
- action2
- action3
- dest1
- dest2
- dest3
and so on.
But I don’t really understand how can I pass this iterate params to a function.
UPD
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
// Create a new filter for [email protected].
$new_filter = $cpanel->uapi(
'Email', 'store_filter',
array(
'filtername' => 'coffee',
'account' => '[email protected]',
'action1' => 'deliver',
'dest1' => '[email protected]',
'part1' => '$header_subject:',
'match1' => 'contains',
'val1' => 'curds',
'opt1' => 'or',
'part2' => '$message_body',
'match2' => 'is',
'val2' => 'whey',
)
);
2
Answers
IMHO you don’t have to do anything extra. JavaScript comes equipped with
Arguments object
,arguments
is an reserved keyword which you can use like this:Or, you can use
spread operator
to do something like this perhaps:NOTE: If you use spread operator the container variable (ie
gatherer
) will be of typeArray
.may be this example helps
Whatever may be the arguments you can pass unlimited arguments and access the same with the function like above.