string-trim-spaces-only
Version:
Like String.trim() but you can choose granularly what to trim
23 lines (20 loc) • 517 B
TypeScript
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 { type Opts, type Res, defaults, trimSpaces, version };