Skip to main content

isNonEmptyJsonObject() function

Determines whether a value is a non-empty JSON object.

Signature

export declare function isNonEmptyJsonObject(value: unknown): boolean;

Parameters

Parameter

Type

Description

value

unknown

The value to test.

Returns

boolean

true if the value is a non-empty JSON object, false otherwise.

Remarks

Combines JSON object validation with a non-empty check, ensuring the object has at least one property. This is useful for validating configuration sections that must contain data to be meaningful.

Returns true for: objects with one or more enumerable properties.

Returns false for: empty objects {}, undefined, null, primitives, arrays, and any non-object types.

The enumerable properties check uses Object.keys(), which only counts own enumerable string-keyed properties, not inherited properties or symbol-keyed properties.

Common use cases include validating xpack.actions, xpack.dependencies, and other package.json sections where an empty object would be meaningless.


Generated via tsdoc2docusaurus 1.3.0-pre by API Extractor/Documenter 7.55.2.