Skip to content

iterateRefs

Official

If callback returns true, the iteration process will be interrupted.

Import:

import { iterateRefs } from 'obsidian';

Example:

iterateRefs(refs, (ref) => {
console.log(ref);
return true;
});
**Signature:**
```ts
function iterateRefs(refs: Reference[], cb: (ref: Reference) => boolean | void): boolean

Parameters:

ParameterTypeDescription
refsReference[]The references to iterate.
cb(ref: Reference) => boolean | voidThe callback to call for each reference.

Returns: booleantrue if callback ever returns true, false otherwise.

Example:

iterateRefs(refs, (ref) => {
console.log(ref);
return true;
});