# Functions

## General

### MO_INCLUDE_BASE64URL

Includes a file base64url encoded.
Returns an unquoted string.
```
Usage: {{MO_INCLUDE_BASE64URL '<filename>'}}
```
```
Usage: {{MO_INCLUDE_BASE64URL '<filename>' '<basedir>'}}
```

### MO_INCLUDE_JSON_ENCODE

Include a file json encoded.
Returns a quoted string.
```
Usage: {{MO_INCLUDE_JSON_ENCODE '<filename>'}}
```
```
Usage: {{MO_INCLUDE_JSON_ENCODE '<filename>' '<basedir>'}}
```

### MO_COMMA_IF_NOT_EMPTY

Returns a comma if arguments are not empty.
```
Usage: {{MO_COMMA_IF_NOT_EMPTY 'VAR_NAME_1' 'VAR_NAME_2' 'VAR_NAME_3'}}
```

### MO_BASE64URL

Encodes the first argument as base64url
Returns an unquoted string.
```
Usage: {{MO_BASE64URL '<string>'}}
```

### MO_VAR_PARSE_IF

Includes the variable if condition is true.
```
Usage: {{MO_VAR_PARSE_IF 'F5_VERSION' '17' 'VARIABLE'}}
```

### MO_VALUE_EXPAND_OR_DEFAULT

Prints the expanded variable value of first two arguments or provided default (last value) if the variable is empty.
```
Usage: {{MO_VALUE_EXPAND_OR_DEFAULT 'VAR_JSON_MAX_ARRAY_LENGTH_' {{JCP_FRIENDLY_VAR}} {{VAR_JSON_MAX_ARRAY_LENGTH}}}}
```

### MO_VALUE_OR_DEFAULT

Prints variable value or provided default if the variable is empty.
```
Usage: {{MO_VALUE_OR_DEFAULT 'VAR_BAD_UNESCAPE' 'true'}}
```

### MO_VAR_PARSE

Parses the variable with mustache before including it.
```
Usage: {{MO_VAR_PARSE '<text>'}}
```

### MO_CSV_GET_ENTRY

Returns an entry from a comma separated list.
```
Usage: {{MO_CSV_GET_ENTRY {{.}} '1'}}
```

### MO_TRUE_IF_NOT_EMPTY

Prints true if variable is not empty, else false.
```
Usage: {{MO_TRUE_IF_NOT_EMPTY 'VAR_HOSTNAMES'}}
```

### MO_COMMA_IF_NOT_FIRST

Returns a comma if it is not the first item in a loop.
```
Usage: {{MO_COMMA_IF_NOT_FIRST}}
```

### MO_CSV_GET_FIRST

Returns the first entry from a comma separated list.
```
Usage: {{MO_CSV_GET_FIRST {{.}}}}
```

### MO_INCLUDE_PARSE

Parses the file with mustache before including it
```
Usage: {{MO_INCLUDE_PARSE '<filename>'}}
```
```
Usage: {{MO_INCLUDE_PARSE '<filename>' '<basedir>'}}
```

### MO_CSV_GET_ENTRY_OR_DEFAULT

Returns an entry from a comma separated list or default value if not found.
```
Usage: {{MO_CSV_GET_ENTRY {{.}} '1' 'default'}}
```

### MO_INCLUDE_PLAIN

Include an external file.
```
Usage: {{MO_INCLUDE_PLAIN '<filename>'}}
```
```
Usage: {{MO_INCLUDE_PLAIN '<filename>' '<basedir>'}}
```

### MO_INCLUDE_BASE64

Includes a file base64 encoded.
Returns an unquoted string.
```
Usage: {{MO_INCLUDE_BASE64 '<filename>'}}
```
```
Usage: {{MO_INCLUDE_BASE64 '<filename>' '<basedir>'}}
```

### MO_CSV_GET_LAST

Returns the last entry from a comma separated list.
```
Usage: {{MO_CSV_GET_LAST {{.}}}}
```

## AS3

### MO_F5_AS3_INCLUDE_DECLARATION

Recursively includes an json path from/in an AS3 declaration, removes .class, .template, .remark and .label keys.
Supports up to 10 KEY=VALUE pairs as arguments.
Arguments are accessible with ARG_ prefix.
```
Usage: {{MO_F5_AS3_INCLUDE_DECLARATION '<json file>' '<json path>' 'VAR1=VALUE1'}}
```

### MO_F5_AS3_INCLUDE_IFILES_FROM_FOLDER

Includes all iFiles from specified folder.
All files but hidden are included.
```
Usage: {{MO_F5_AS3_INCLUDE_IFILES_FROM_FOLDER '<folder>'}}
```

### MO_IP_RANGE

Prints all IPs in a range (including start and end) for the last octet

### MO_F5_AS3_INCLUDE_IRULES_FROM_FOLDER

Includes all iRules from specified folder.
iRule Files must end with .irule.
```
Usage: {{MO_F5_AS3_INCLUDE_IRULES_FROM_FOLDER '<folder>'}}
```

