Skip to content

ListValue

Official

Value wrapping an array of Values. Values do not all need to be of the same type.

Import:

import { ListValue } from 'obsidian';

Signature:

export class ListValue extends NotNullValue

Extends: NotNullValue

Constructor

new ListValue(value: unknown[])

Constructor.

To get the constructor instance, use getListValueConstructor from obsidian-typings/implementations.

Properties

Property Type Description
data unknown[] The wrapped array of raw elements. Elements are lazily wrapped into Values on access.
type string

Methods

Method Returns Description
compare(other, comparator) boolean Compares this list to another element-wise using the provided comparator.
concat(other) ListValue Get a new obsidian#ListValue containing the elements from this obsidian#ListValue and the provided obsidian#ListValue.
earliest() Value Returns the earliest date among the list's elements.
flatten() ListValue Returns a new flattened list, recursively inlining nested lists.
get(index) Value Get the value at the provided index.
getDates() Date[] Extracts the dates from the list's elements.
getNumbers() number[] Extracts the numbers from the list's elements.
includes(value) boolean Returns a boolean indicating whether any elements in this list loosely equal the provided value.
isTruthy() boolean Returns a boolean indicating whether this obsidian#ListValue is truthy.
join(separator) StringValue Joins the list's elements into a single string.
latest() Value Returns the latest date among the list's elements.
lazyEvaluator(index, raw) Value Wraps a raw element at the given index into a Value.
length() number Get the number of elements in this list.
max() Value Returns the maximum of the list's numeric elements.
mean() Value Returns the mean of the list's numeric elements.
median() Value Returns the median of the list's numeric elements.
min() Value Returns the minimum of the list's numeric elements.
reverse() ListValue Returns a new list with the elements in reverse order.
slice(start?, end?) ListValue Returns a shallow slice of the list.
sort() ListValue Returns a new sorted list.
stddev() Value Returns the standard deviation of the list's numeric elements.
sum() Value Returns the sum of the list's numeric elements.
toString() string Get the string representation of this obsidian#ListValue.
unique() ListValue Returns a new list with duplicate elements removed.

Links to this page: