6 addArrayElementsUnique: function ( arr
, elements
) {
7 elements
= Array
.isArray( elements
) ? elements
: [ elements
];
9 elements
.forEach( function ( element
) {
10 if ( arr
.indexOf( element
) === -1 ) {
17 normalizeParamOptions: function ( givenOptions
, legalOptions
) {
20 if ( givenOptions
.indexOf( 'all' ) > -1 ) {
21 // If anywhere in the values there's 'all', we
22 // treat it as if only 'all' was selected.
23 // Example: param=valid1,valid2,all
28 // Get rid of any dupe and invalid parameter, only output
30 // Example: param=valid1,valid2,invalid1,valid1
31 // Result: param=valid1,valid2
32 givenOptions
.forEach( function ( value
) {
34 legalOptions
.indexOf( value
) > -1 &&
35 result
.indexOf( value
) === -1