Like the fields()
method, but returns an array containing the field name/value pairs with all of
the associated values to a field name, instead of field name/value pairs with just the last associated value
to a field name. For example, for the
following struct:
{
foo: 1,
foo: null,
foo: true,
}
a call to fields()
would return a field name "foo" with a dom.Boolean
representing true
while a call to allFields()
would return a field name "foo" with an Array
of
dom.Value
s: [1, null, true]
.
Allows for easy type casting from Value to a particular implementation of Value.
If the Value is an instance of the type T
represented by the provided constructor, this
function will cast it as type T
and return it; otherwise throws an Error.
For the Integer type, returns a BigInt representation of the Value; otherwise throws an Error.
For the Boolean type, returns a JS boolean representation of the Value; otherwise throws an Error.
For the Timestamp type, returns a JS Date representation of the Value; otherwise throws an Error.
Note that the conversion from an ion.Timestamp to a Date can involve a loss of precision. See timestampValue() for a lossless alternative.
For the Decimal type, returns an ion.Decimal representation of the Value; otherwise throws an Error.
For the Struct type, deletes the field with provided name if present. Returns a boolean indicating whether the Struct was modified. For all other types, throws an Error.
For the Struct, List, and SExpression types, returns an array containing the container's nested values; otherwise throws an Error.
Compares this instance of dom.Value to the provided value and returns true
if they are equal. If other
is a dom.Value, this comparison checks for structural
(or "non-strict") equivalence.
other Ion Value or Js Object to be compared with this Ion Value.
options provided for equivalence as below epsilon used by Float for an equality with given epsilon precision. (Default: null)
For the Struct type, returns an array containing the names of the fields in the Struct; otherwise throws an Error.
For the Struct type, returns an array containing the field name/value pairs in the Struct; otherwise throws an Error.
Attempts to index into the Value with each pathElement in turn until:
but the current PathElement is not a fieldName that exists in the Struct.)
One or more values to be used to index into the Value.
null if no value is found at the specified path. Otherwise, returns the discovered Value.
Like the get(PathElement[])
method, but returns all of the values associated
with a given field name instead of just the last one. For example, for the
following struct:
{
foo: 1,
foo: null,
foo: true,
}
a call to get("foo")
would return a dom.Boolean
representing true
while a call to getAll("foo")
would return an Array
of
dom.Value
s: [1, null, true]
.
null if no value is found at the specified path. Otherwise, returns the discovered Value.
Returns an array containing any annotations associated with this value. If this value does not have any annotations, an empty array will be returned.
Returns the Ion type of this value.
For checking equivalence of an Ion Values represented by dom.Value with the other value represented by dom.Value.
Strict equivalence refers to Ion data model equivalence as defined in Ion Equivalence[1] and by Ion Specification[2]
Structural or non-strict equivalence follows the same rules as strict equivalence, except that
[1] https://www.javadoc.io/doc/com.amazon.ion/ion-java/latest/com/amazon/ion/util/Equivalence.html [2] http://amzn.github.io/ion-docs/docs/spec.html
other Ion Value to be compared with this Ion Value.
options provided for equivalence as below epsilon used by Float for an equality with given epsilon precision. (Default: null) ignoreAnnotations specifies whether to ignore annotations or not for equality. (Default: false) ignoreTimestampPrecision specifies whether to ignore timestamp local offset and precision or not for equality. (Default: false)
Returns true if this Value is a Null and false otherwise.
For the Integer, Float, and Decimal types, returns a JS number representation of the Value; otherwise throws an Error.
In some cases, this method will perform conversions that inherently involve loss of precision. See bigIntValue() and decimalValue() for lossless alternatives.
For the String and Symbol types, returns a JS string representation of the Value's text; otherwise throws an Error.
For the Timestamp type, returns an ion.Timestamp representation of the Value; otherwise throws an Error.
For the Blob and Clob types, returns a Uint8Array representation of the Value's bytes; otherwise throws an Error.
Writes the Ion value represented by this dom.Value (including annotations) to the provided Writer. If the value is a container, writeTo() will be called recursively on its nested values.
An Ion Writer to which the value should be written.
Provides a common interface to work with DOM elements of any Ion type.
Implementors should return
null
for any method that cannot provide the requested value.