Member Junction
    Preparing search index...
    • Type guard for a PLAIN JSON-ish object — a non-null object that is not an array.

      This is the predicate every deep-merge, tolerant-parse, and config-cascade routine needs before recursing into a value, and it had been re-implemented locally in roughly a dozen packages. Use this one instead of writing another.

      Deliberately structural rather than strict: it accepts class instances, Date, Map, etc., because the callers that need it are merging/walking JSON-shaped data where those either cannot appear or should be treated as opaque leaves. If you need to exclude them, test for the specific case at the call site — IsPlainObject(x) && !(x instanceof Date).

      Parameters

      • value: unknown

        The value to test

      Returns value is Record<string, unknown>

      True when value is a non-null, non-array object

      if (IsPlainObject(existing) && IsPlainObject(incoming)) {
      mergeInto(existing, incoming); // both sides are objects — recurse
      } else {
      target[key] = incoming; // scalar / array / null — replace
      }