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

PropertyTypeDescription
dataunknown[]The wrapped array of raw elements. Elements are lazily wrapped into Values on access.
typestring

Methods

MethodReturnsDescription
compare(other, comparator)booleanCompares this list to another element-wise using the provided comparator.
concat(other)ListValueGet a new obsidian#ListValue containing the elements from this obsidian#ListValue and the provided obsidian#ListValue.
earliest()ValueReturns the earliest date among the list's elements.
flatten()ListValueReturns a new flattened list, recursively inlining nested lists.
get(index)ValueGet 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)booleanReturns a boolean indicating whether any elements in this list loosely equal the provided value.
isTruthy()booleanReturns a boolean indicating whether this obsidian#ListValue is truthy.
join(separator)StringValueJoins the list's elements into a single string.
latest()ValueReturns the latest date among the list's elements.
lazyEvaluator(index, raw)ValueWraps a raw element at the given index into a Value.
length()numberGet the number of elements in this list.
max()ValueReturns the maximum of the list's numeric elements.
mean()ValueReturns the mean of the list's numeric elements.
median()ValueReturns the median of the list's numeric elements.
min()ValueReturns the minimum of the list's numeric elements.
reverse()ListValueReturns a new list with the elements in reverse order.
slice(start?, end?)ListValueReturns a shallow slice of the list.
sort()ListValueReturns a new sorted list.
stddev()ValueReturns the standard deviation of the list's numeric elements.
sum()ValueReturns the sum of the list's numeric elements.
toString()stringGet the string representation of this obsidian#ListValue.
unique()ListValueReturns a new list with duplicate elements removed.

Links to this page: