mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 20:31:36 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -1,14 +1,22 @@
|
||||
import { parseTimeoutMs } from "./parse-timeout.js";
|
||||
|
||||
export function parseEnvPairs(pairs: unknown): Record<string, string> | undefined {
|
||||
if (!Array.isArray(pairs) || pairs.length === 0) return undefined;
|
||||
if (!Array.isArray(pairs) || pairs.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
const env: Record<string, string> = {};
|
||||
for (const pair of pairs) {
|
||||
if (typeof pair !== "string") continue;
|
||||
if (typeof pair !== "string") {
|
||||
continue;
|
||||
}
|
||||
const idx = pair.indexOf("=");
|
||||
if (idx <= 0) continue;
|
||||
if (idx <= 0) {
|
||||
continue;
|
||||
}
|
||||
const key = pair.slice(0, idx).trim();
|
||||
if (!key) continue;
|
||||
if (!key) {
|
||||
continue;
|
||||
}
|
||||
env[key] = pair.slice(idx + 1);
|
||||
}
|
||||
return Object.keys(env).length > 0 ? env : undefined;
|
||||
|
||||
Reference in New Issue
Block a user