Module $_.util
Defined in: util.js.
Method Summary
array_combine(array/object, array/object)Creates an object, with the property names of the first array, and the values of the second.
str_trans(string, mixed, string)Replaces sections of strings in a greedy fashion, starting with the longest replace pairs first.
Method Detail
$_.util.object_keys(object): array
Retrieve the keys, or member names of an object
Parameters:
object |
Returns:
array |
$_.util.object_values(object): array
Retrieves the values of an object, and returns them as an array
Parameters:
object |
Returns:
array |
$_.util.array_combine(array/object, array/object): object
Creates an object, with the property names of the first array, and the values of the second. If objects are passed, the values of the object are used. If the arrays or objects passed are not the same size, the function will return false.
Parameters:
array/object | keys | |
array/object | vals |
Returns:
object |
$_.util.object_merge(object): object
Combines two or more objects/arrays. If the keys are numeric, the outputted object will have re-indexed keys. If a key/value pair exists in both objects, indentical values will be droped, but if a key exists with a different value, with the same key, the value in the second array will replace the value in the first
Parameters:
object | [as many as you wish to combine] |
Returns:
object |
$_.util.str_trans(string, mixed, string): string
Replaces sections of strings in a greedy fashion, starting with the longest replace pairs first. Accepts one replace pair as two parameters, or an object, with from => to replacements as key/value pairs
Parameters:
string | input_string | |
mixed | from (string)/replace pairs (object) | |
string?, Default: |
Returns:
string |