Skip to content

pathsValidator

Validates include/exclude path entries, reporting the first entry that is not a parseable regular expression.

An entry that starts and ends with / is a regular expression literal; every other entry is a plain path and is always valid. An invalid entry does not throw when assigned to PathSettings — the whole list falls back to its default pattern instead — so this validator is what surfaces the problem to the user.

Import:

import { pathsValidator } from '@mnaoumov/obsidian-lib/path-settings';

Signature:

function pathsValidator(paths: string[]): MaybeReturn<string>

Parameters:

Parameter Type Description
paths string[] The path entries to validate.

Returns: MaybeReturn<string> — A message naming the first invalid entry, or nothing when every entry is valid.