mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:40:44 +00:00
refactor: hide utility helper internals
This commit is contained in:
@@ -9,7 +9,7 @@ function isJsonObject(value: unknown): value is Record<string, unknown> {
|
||||
return typeof value === "object" && value !== null && !Array.isArray(value);
|
||||
}
|
||||
|
||||
export function decodeJsonPointerToken(token: string): string {
|
||||
function decodeJsonPointerToken(token: string): string {
|
||||
return token.replace(/~1/g, "/").replace(/~0/g, "~");
|
||||
}
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ export function ensureObject(
|
||||
return next;
|
||||
}
|
||||
|
||||
export function normalizeKnownProvider(
|
||||
function normalizeKnownProvider(
|
||||
value: unknown,
|
||||
providers: Array<{ id: string }>,
|
||||
): string | undefined {
|
||||
|
||||
@@ -10,9 +10,7 @@ type NetworkInterfaceEntryInput = {
|
||||
netmask?: string;
|
||||
};
|
||||
|
||||
export function makeNetworkInterfaceEntry(
|
||||
input: NetworkInterfaceEntryInput,
|
||||
): NetworkInterfaceEntry {
|
||||
function makeNetworkInterfaceEntry(input: NetworkInterfaceEntryInput): NetworkInterfaceEntry {
|
||||
if (input.family === "IPv6") {
|
||||
return {
|
||||
address: input.address,
|
||||
|
||||
@@ -12,7 +12,7 @@ const WORD_BOUNDARY_CHARS = /[\s\-_./:#@]/;
|
||||
/**
|
||||
* Check if position is at a word boundary.
|
||||
*/
|
||||
export function isWordBoundary(text: string, index: number): boolean {
|
||||
function isWordBoundary(text: string, index: number): boolean {
|
||||
return index === 0 || WORD_BOUNDARY_CHARS.test(text[index - 1] ?? "");
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ export function findWordBoundaryIndex(text: string, query: string): number | nul
|
||||
* Fuzzy match with pre-lowercased inputs (avoids toLowerCase on every keystroke).
|
||||
* Returns score (lower = better) or null if no match.
|
||||
*/
|
||||
export function fuzzyMatchLower(queryLower: string, textLower: string): number | null {
|
||||
function fuzzyMatchLower(queryLower: string, textLower: string): number | null {
|
||||
if (queryLower.length === 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user