Description
(Added at v3.8)
Utility methods for working with strings, arrays and objects.
When coding legacy (non-AMD) style, there is no need to require the module. All methods and properties are available in the namespace. For example,
esri.filter()
.
Samples
Search for
samples that use this class.
Methods
Method Details
Creates a new object with all properties that pass the test implemented by the filter provided in the function.
Parameters:
<Object > object |
Required |
Object to filter. |
<Function > callback |
Required |
Function or string implementing the filtering. |
<Object > thisObject |
Optional |
Optional object used to scope the call to the callback. |
Sample:
function showResults(results) {
var filterFunction = function(value) {
if ((value !== ' ') & (Number(value) !== 0)) {
return true;
};
};
var filteredResults = esri.filter(results.features[0].attributes, filterFunction);
var s = "";
for (att in filteredResults) {
s = s + "<b>" + att + ":</b> " + filteredResults[att] + "<br />";
};
dojo.byId("info").innerHTML = s;
};
Returns true when the value is neither null or undefined. Otherwise false.
Parameters:
<Object > value |
Required |
The value to test. |
Strips HTML tags from a String or Object. This method modifies the Object used as input and does not return a new value. If a String is used as input, a new String is returned. (Added at v3.13)
Parameters:
<Object | String > value |
Required |
Object or String to be stripped of HTML tags. |
A wrapper around dojo.string.substitute that can also handle wildcard substitution. A wildcard uses the format of
${*}. If no template is provided, it is assumed to be a wildcard. This method is useful if you are not using
Graphic or an
InfoTemplate, but you want to embed result values in HTML, for example.
Parameters:
<Object > data |
Required |
The data object used in the substitution. |
<String > template |
Optional |
The template used for the substitution. Can be any valid HTML. If no template is included, the wildcard template is used. |
<Object > options |
Optional |
Object containing a format object used in the substitution. |
Object Specifications: <options
>
<Object > format |
Optional |
This object contains key:value pairs where the key is either a - field name or
- user-defined identifier.
The value object supports formatType property. This can be one of the following types:NumberFormat , supported by dojo.number.__FormatOptions , or DateFormat , supported by dojo.date.locale.__FormatOptions .
|
<Object > format |
Optional |
This object contains key:value pairs where the key is either a - field name or
- user-defined identifier.
The value object supports formatType property. This can be one of the following types:NumberFormat , supported by dojo.number.__FormatOptions , or DateFormat , supported by dojo.date.locale.__FormatOptions .
|
Iterates through the argument array and searches for the identifier to which the argument value matches. Returns null if no matching identifier is found.
Parameters:
<Array > array |
Required |
The argument array for testing. |
<Object > value |
Required |
The value used in the search. If the value is a String, the value is case sensitive. |
Sample: Example 1:
esri.valueOf([firststring: "Oregon", secondstring: "Washington"], "Washington");
Returns: secondstring
Example 2:
esri.valueOf([firststring: "Oregon", secondstring: "Washington"], "Virginia");
Returns: null