Skip to content

each

Iterates over an object’s own enumerable string-keyed entries, stopping early when the callback returns false.

Import:

import 'obsidian-test-mocks/setup';

Signature:

function each(object: Record<string, unknown>, callback: (value: unknown, key?: string | undefined) => MaybeReturn<boolean>, context: unknown): boolean

Parameters:

Parameter Type Description
object Record<string, unknown> The object to iterate over.
callback (value: unknown, key?: string | undefined) => MaybeReturn<boolean> Called with each value and its key; returning false stops the iteration.
context unknown The this value the callback is called with.

Returns: boolean — false when the callback stopped the iteration, otherwise true.