Files
backend/.pnpm-store/v10/files/00/bf173e08e74f5b28344133a65878971ace7fc039c1c7ba7bd5379ad7795f22b364e6069e93d5c303d3f25a4b16d8be62fdc55bf48020e365d74f0ea17cbe4d
T
2026-03-22 13:31:39 +00:00

30 lines
593 B
Plaintext

import type {Whitespace} from './internal/index.d.ts';
/**
Remove spaces from the left side.
*/
type TrimLeft<V extends string> = V extends `${Whitespace}${infer R}` ? TrimLeft<R> : V;
/**
Remove spaces from the right side.
*/
type TrimRight<V extends string> = V extends `${infer R}${Whitespace}` ? TrimRight<R> : V;
/**
Remove leading and trailing spaces from a string.
@example
```
import type {Trim} from 'type-fest';
type Example = Trim<' foo '>;
//=> 'foo'
```
@category String
@category Template literal
*/
export type Trim<V extends string> = TrimLeft<TrimRight<V>>;
export {};