/** * @file Safe references to `String` static methods and prototype methods. * `StringPrototypeCharCodeAt` prefers the smol Fast API binding for ASCII * inputs, which reduces to a single byte load, and translates the `-1` Fast * API sentinel back to `NaN` to preserve spec parity. Two-byte strings fall * back to the uncurried `String.prototype.charCodeAt`. * * ## Fast API surface — and why it's small * * Mirrors the design rationale from socket-btm's `primordial_binding.cc` * (lines 41-72). The smol Fast API exposes exactly one string op * (`stringCharCodeAt`) because that's the one shape where the C++ trampoline * genuinely beats V8's existing hot path: a single ASCII byte load, no * encoding dispatch, no HandleScope, returns a primitive. String **searches** * (`startsWith` / `endsWith` / `includes` / `indexOf` / `lastIndexOf`) are * intentionally NOT exposed. V8's existing hot path dispatches on encoding * and runs native SIMD memcmp — a Fast API binding would add overhead without * winning. Same for `Map.has` / `Set.has` / `Array.includes`. Fast API also * has a hard constraint: a fast-path function cannot return a new V8 object — * only primitives, Local, or FastOneByteString. That * rules out anything that produces a new string (`slice`, `substring`, * `toUpperCase`, `concat`, `repeat`, `padStart`/`padEnd`, formatted-number) * from ever being a Fast API win on the return path. Net: the current surface * is approximately the ceiling. Adding more Fast API string ops without a * flamegraph showing the cost is a regression risk, not a perf win. See * `socket-btm/packages/node-smol-builder/additions/source-patched/` * `src/socketsecurity/primordial/primordial_binding.cc:41-72` for the * canonical design statement. */ export declare const StringCtor: StringConstructor; export declare const StringFromCharCode: (...codes: number[]) => string; export declare const StringFromCodePoint: (...codePoints: number[]) => string; export declare const StringRaw: (template: { raw: readonly string[] | ArrayLike; }, ...substitutions: any[]) => string; export declare const StringPrototypeAt: (self: unknown, index: number) => string | undefined; export declare const StringPrototypeCharAt: (self: unknown, pos: number) => string; export declare function smolStringCharCodeAt(s: string, i: number): number; export declare const StringPrototypeCharCodeAt: (s: string, i: number) => number; export declare const StringPrototypeCodePointAt: (self: unknown, pos: number) => number | undefined; export declare const StringPrototypeConcat: (self: string, ...strs: string[]) => string; export declare const StringPrototypeEndsWith: (self: unknown, searchString: string, endPosition?: number | undefined) => boolean; export declare const StringPrototypeIncludes: (self: unknown, searchString: string, position?: number | undefined) => boolean; export declare const StringPrototypeIndexOf: (self: unknown, searchString: string, position?: number | undefined) => number; export declare const StringPrototypeIsWellFormed: (s: string) => boolean; export declare const StringPrototypeLastIndexOf: (self: unknown, searchString: string, position?: number | undefined) => number; export declare const StringPrototypeLocaleCompare: (self: unknown, that: string, locales?: Intl.LocalesArgument, options?: Intl.CollatorOptions | undefined) => number; export declare const StringPrototypeMatch: (self: string, matcher: string | RegExp) => RegExpMatchArray | null; export declare const StringPrototypeMatchAll: (self: string, matcher: string | RegExp) => IterableIterator; export declare const StringPrototypeNormalize: (self: unknown, form?: string | undefined) => string; export declare const StringPrototypePadEnd: (self: unknown, targetLength: number, padString?: string | undefined) => string; export declare const StringPrototypePadStart: (self: unknown, targetLength: number, padString?: string | undefined) => string; export declare const StringPrototypeRepeat: (self: unknown, count: number) => string; export declare const StringPrototypeReplace: (self: string, searchValue: string | RegExp, replaceValue: string | ((substring: string, ...args: unknown[]) => string)) => string; export declare const StringPrototypeReplaceAll: (self: string, searchValue: string | RegExp, replaceValue: string | ((substring: string, ...args: unknown[]) => string)) => string; export declare const StringPrototypeSearch: (self: unknown, searcher: { [Symbol.search](string: string): number; }) => number; export declare const StringPrototypeSlice: (self: unknown, start?: number | undefined, end?: number | undefined) => string; export declare const StringPrototypeSplit: (self: string, separator: string | RegExp, limit?: number | undefined) => string[]; export declare const StringPrototypeStartsWith: (self: unknown, searchString: string, position?: number | undefined) => boolean; export declare const StringPrototypeSubstring: (self: unknown, start: number, end?: number | undefined) => string; export declare const StringPrototypeToLocaleLowerCase: (self: unknown, locales?: Intl.LocalesArgument) => string; export declare const StringPrototypeToLocaleUpperCase: (self: unknown, locales?: Intl.LocalesArgument) => string; export declare const StringPrototypeToLowerCase: (self: unknown) => string; export declare const StringPrototypeToString: (self: unknown) => string; export declare const StringPrototypeToUpperCase: (self: unknown) => string; export declare const StringPrototypeToWellFormed: (self: unknown) => string; export declare const StringPrototypeTrim: (self: unknown) => string; export declare const StringPrototypeTrimEnd: (self: unknown) => string; export declare const StringPrototypeTrimStart: (self: unknown) => string; export declare const StringPrototypeValueOf: (self: unknown) => string;