mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 18:34:33 +00:00
refactor: share plain object guard across config and utils
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { isPlainObject } from "../infra/plain-object.js";
|
||||
|
||||
/**
|
||||
* Preserves `${VAR}` environment variable references during config write-back.
|
||||
*
|
||||
@@ -16,15 +18,6 @@
|
||||
|
||||
const ENV_VAR_PATTERN = /\$\{[A-Z_][A-Z0-9_]*\}/;
|
||||
|
||||
function isPlainObject(value: unknown): value is Record<string, unknown> {
|
||||
return (
|
||||
typeof value === "object" &&
|
||||
value !== null &&
|
||||
!Array.isArray(value) &&
|
||||
Object.prototype.toString.call(value) === "[object Object]"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a string contains any `${VAR}` env var references.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user