gnablib
Version:
A lean, zero dependency library to provide a useful base for your project.
43 lines (42 loc) • 1.78 kB
TypeScript
/*! Copyright 2023-2024 the gnablib contributors MPL-1.1 */
declare const consoleDebugSymbol: unique symbol;
export type WindowOrString = WindowStr | string;
export declare class WindowStr {
private readonly _src;
private _start;
private _len;
protected constructor(source: String, start: number, len: number);
get length(): number;
get empty(): boolean;
toString(): string;
get [Symbol.toStringTag](): string;
[consoleDebugSymbol](): string;
debug(): string;
charAt(idx: number): string;
codePointAt(idx: number): number;
endsWith(searchString: string): boolean;
indexOf(searchString: string, start?: number): number;
indexOfAny(search: string[], start?: number): number;
lastIndexOf(searchString: string, length?: number): number;
lastIndexOfAny(search: string[], length?: number): number;
left(length: number): WindowStr;
match(regexp: {
[Symbol.match](string: string): RegExpMatchArray | null;
}): RegExpMatchArray | null;
peerOf(other: WindowStr): boolean;
getReset(): () => [number, number];
right(length: number): WindowStr;
shrink(startBy?: number, lengthBy?: number): WindowStr;
span(start: number, length?: number): WindowStr;
split(separator: string, limit?: number): WindowStr[];
startsWith(searchString: string): boolean;
substring(start: number, end?: number): string;
test(regexp: RegExp): boolean;
trim(chars?: string[]): WindowStr;
trimEnd(chars?: string[], limit?: number): WindowStr;
trimStart(chars?: string[], limit?: number): WindowStr;
[Symbol.iterator](): Iterator<string>;
static new(source: string, start?: number, length?: number): WindowStr;
static coerce(source: WindowOrString): WindowStr;
}
export {};