frontend/.pnpm-store/v3/files/a3/c1705f35e08bfd1fd50dacfdd32b69dd7ed0725195883b9cc44f75b2b32011ebffdc16b7f1f1a2ca73b43b6389722bbf741fda664059910a3f7fe5a37962c9

28 lines
554 B
Plaintext

import type {Whitespace} from './internal';
/**
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';
Trim<' foo '>
//=> 'foo'
```
@category String
@category Template literal
*/
export type Trim<V extends string> = TrimLeft<TrimRight<V>>;