Skip to content

trimWindowsTrailingChars

Removes the trailing dots and spaces Windows refuses from the end of a name.

Trim before testing for a reserved name, never after: trimming afterwards turns an accepted CON into a rejected CON. isWindowsReservedName already does this internally.

Import:

import { trimWindowsTrailingChars } from 'obsidian-dev-utils/obsidian/validation';

Signature:

function trimWindowsTrailingChars(name: string): string

Parameters:

ParameterTypeDescription
namestringThe name to trim. A single path segment, not a path.

Returns: string — The name without its trailing dots and spaces, which may be empty.