Skip to content

checkExtension

Checks if the given path or file has the specified extension.

Import:

import { checkExtension } from 'obsidian-dev-utils/obsidian/file-system';

Signature:

function checkExtension(pathOrFile: PathOrAbstractFile | null, extension: string): boolean

Parameters:

ParameterTypeDescription
pathOrFilePathOrAbstractFile | nullThe path or abstract file to check.
extensionstringThe extension to compare against.

Returns: boolean — Returns true if the path or file has the specified extension, false otherwise.