M module

Support.module:Array

descirption...

Functions

Returns the last element of an array

Parameters

value : Array

The array to get the last element from

Returns

*

The last element of the array

Ensures a value is an array by wrapping it if necessary. If value is already an array, returns it unchanged; otherwise wraps the value in an array. Unlike Array.from, which converts iterables and array-likes, this wraps scalars (e.g. toArray(5) is [5]).

Parameters

value : *

The value to wrap

Returns

Array

The value as an array

Calls to_param on all its elements and joins the result with slashes. This is used by url_for in Viking Pack.

Parameters

value : Array

The array to convert to a parameter string

Returns

string

A string with array values converted to parameters and joined with slashes

Converts an array into a string suitable for use as a URL query string, using the given key as the param name.

Parameters

value : Array

The array to convert to a query string

key : string

The key to use as the parameter name

Returns

string

A URL query string representation of the array