Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
array_count, array_prioritize, array_replace added to expressions (#4…
- Loading branch information
Showing
6 changed files
with
175 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "array_count", | ||
"type": "function", | ||
"groups": ["Arrays"], | ||
"description": "Counts the number of occurrences of a given value in an array.", | ||
"arguments": [ {"arg":"array","description":"an array"}, | ||
{"arg":"value","description":"the value to count"}], | ||
"examples": [ { "expression":"array_count(array('a', 'b', 'c', 'b'), 'b')", "returns":"2"}] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "array_prioritize", | ||
"type": "function", | ||
"groups": ["Arrays"], | ||
"description": "Returns an array sorted using the ordering specified in another array. Values which are present in the first array but are missing from the second array will be added to the end of the result.", | ||
"arguments": [ | ||
{"arg":"array", "description":"an array"}, | ||
{"arg":"array_prioritize", "description":"an array with values ordered by priority" }], | ||
"examples": [ { "expression":"array_prioritize(array(1, 8, 2, 5), array(5, 4, 2, 1, 3, 8))", "returns":"[ 5, 2, 1, 8 ]"}, | ||
{"expression":"array_prioritize(array(5, 4, 2, 1, 3, 8), array(1, 8, 6, 5))", "returns":"[ 1, 8, 5, 4, 2, 3 ]"} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "array_replace", | ||
"type": "function", | ||
"groups": ["Array"], | ||
"description": "Returns an array with the supplied value, array, or map of values replaced.", | ||
"variants": [ | ||
{ "variant": "Value & array variant", | ||
"variant_description": "Returns an array with the supplied value or array of values replaced by another value or an array of values.", | ||
"arguments": [ {"arg":"array","description":"the input array"}, | ||
{"arg":"before","description":"the value or array of values to replace"}, | ||
{"arg":"after","description":"the value or array of values to use as a replacement"}], | ||
"examples": [ { "expression":"array_replace(array('QGIS','SHOULD','ROCK'),'SHOULD','DOES')", "returns":"[ 'QGIS', 'DOES', 'ROCK' ]"}, | ||
{ "expression":"array_replace(array(3,2,1),array(1,2,3),array(7,8,9))", "returns":"[ 9, 8, 7 ]"}, | ||
{ "expression":"array_replace(array('Q','G','I','S'),array('Q','S'),'-')", "returns":"[ '-', 'G', 'I', '-' ]"} ] }, | ||
{ "variant": "Map variant", | ||
"variant_description": "Returns an array with the supplied map keys replaced by their paired values.", | ||
"arguments": [ {"arg":"array","description":"the input array"}, | ||
{"arg":"map","description":"the map containing keys and values"} ], | ||
"examples": [ { "expression":"array_replace(array('APP', 'SHOULD', 'ROCK'),map('APP','QGIS','SHOULD','DOES'))", "returns":"[ 'QGIS', 'DOES', 'ROCK' ]"} ] | ||
}] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters