UNPKG

string-trim-spaces-only

Version:

Like String.trim() but you can choose granularly what to trim

24 lines (21 loc) 523 B
type Range = | [from: number, to: number] | [from: number, to: number, whatToInsert: string | null | undefined]; type Ranges = Range[] | null; declare const version: string; interface Opts { classicTrim: boolean; cr: boolean; lf: boolean; tab: boolean; space: boolean; nbsp: boolean; } declare const defaults: Opts; interface Res { res: string; ranges: Ranges; } declare function trimSpaces(str: string, opts?: Partial<Opts>): Res; export { defaults, trimSpaces, version }; export type { Opts, Res };