frontend/.pnpm-store/v3/files/16/231dd6501f573f513b2b92508388b26d3b0cbee10ae9468187ce11be6d2c905b1992982976e95b02befc9d1d2434b2c494b907086ee0d91e241e37910feaa1

25 lines
464 B
Plaintext

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