Param class represents a single parameter within a URL pattern. It manages parameter metadata, encoding/decoding, validation, and default values.
Overview
Properties
id
type
location
DefType.PATH- Path parameter (e.g.,/foo/:param)DefType.SEARCH- Query parameter (e.g.,/foo?param=value)DefType.CONFIG- Non-URL parameter (defined in state params)
isOptional
true if the parameter is optional (has a default value or is a query parameter).
dynamic
true if changes to this parameter value should not cause state reload.
raw
true if the parameter value should not be URL-encoded.
squash
false- Include in URLtrue- Omit from URL (and remove a slash if surrounded by slashes)string- Replace with this string value
array
true if the parameter value should be treated as an array.
inherit
true if the parameter value should be inherited during transitions with inherit: true.
Methods
value()
Gets the processed parameter value.value- The raw parameter value
value is undefined).
This method applies the parameter’s type normalization and returns the default value if the input is undefined.
isDefaultValue()
Checks if a value is the default value.value- The value to check
true if the value equals the default value.
validates()
Validates a parameter value.value- The value to validate
true if the value is valid for this parameter.
isSearch()
Checks if this is a search (query) parameter.true if this parameter is located in the query string.
toString()
Returns a string representation of the parameter.Static Methods
values()
Processes an array of parameters with given values.params- Array of Param objectsvalues- Raw parameter values
changed()
Finds parameters with different values.params- Array of Param objectsvalues1- First set of parameter valuesvalues2- Second set of parameter values
values1 and values2.
equals()
Checks if two parameter value objects are equal.params- Array of Param objects to checkvalues1- First set of parameter valuesvalues2- Second set of parameter values
true if the parameter values are equal.
validates()
Validates parameter values for an array of parameters.params- Array of Param objectsvalues- Parameter values to validate
true if all parameter values are valid.