mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-13 18:21:27 +00:00
refactor: dedupe core lowercase helpers
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import { normalizeLowercaseStringOrEmpty } from "../shared/string-coerce.js";
|
||||
|
||||
const NODE_VERSIONED_PATTERN = /^node(?:-\d+|\d+)(?:\.\d+)*(?:\.exe)?$/;
|
||||
|
||||
function normalizeRuntimeBasename(execPath: string): string {
|
||||
const trimmed = execPath.trim().replace(/^["']|["']$/g, "");
|
||||
const lastSlash = Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\"));
|
||||
const basename = lastSlash === -1 ? trimmed : trimmed.slice(lastSlash + 1);
|
||||
return basename.toLowerCase();
|
||||
return normalizeLowercaseStringOrEmpty(basename);
|
||||
}
|
||||
|
||||
export function isNodeRuntime(execPath: string): boolean {
|
||||
|
||||
Reference in New Issue
Block a user