UNPKG

obsidian-dev-utils

Version:

This is the collection of useful functions that you can use for your Obsidian plugin development

50 lines (49 loc) 1.72 kB
/** * @packageDocumentation * * Validation utilities. */ /** * Holds a validation message. */ export interface ValidationMessageHolder { /** * A validation message. */ validationMessage: string; } /** * Type guard to check if a value is a validation message holder. * * @param value - The value to check. * @returns `true` if the value is a validation message holder, `false` otherwise. */ export declare function isValidationMessageHolder(value: unknown): value is ValidationMessageHolder; /** * Matches characters that are not safe to use in file names within Obsidian. */ export declare const OBSIDIAN_UNSAFE_FILENAME_CHARS: RegExp; /** * Windows-specific unsafe file name path characters. */ export declare const WINDOWS_UNSAFE_PATH_CHARS: RegExp; /** * Unix-specific unsafe file name path characters. */ export declare const UNIX_UNSAFE_PATH_CHARS: RegExp; /** * Returns a regexp matching all unsafe characters in file names/paths. * * Includes both OS-specific restrictions and Obsidian-specific ones. * * @param isWindows - Whether to include Windows-specific restrictions. Defaults to `Platform.isWin`. * @returns A regexp matching all unsafe characters in file names/paths. */ export declare function getOsAndObsidianUnsafePathCharsRegExp(isWindows?: boolean): RegExp; /** * Returns a regexp matching characters that are not safe to use in file names/paths at the OS level. * * @param isWindows - Whether to include Windows-specific restrictions. Defaults to `Platform.isWin`. * @returns A regexp matching characters that are not safe to use in file names/paths at the OS level. */ export declare function getOsUnsafePathCharsRegExp(isWindows?: boolean): RegExp;