object
Internal library of helpers for manipulating objects.
isEmpty()β
function isEmpty<T>(obj): obj is Exclude<unknown, T>
Check if an object contains key/value records.
Type Parametersβ
β’ T extends Record
<string
, unknown
>
Parametersβ
objβ
unknown
the key/value record object.
Returnsβ
obj is Exclude<unknown, T>
false
if the object is a valid k/v set of records, else true
.
Exampleβ
import { isEmpty } from '@graphql-markdown/utils/object';
const obj = {
bool: true,
string: "test",
number: 123,
array: ["one", "two"],
child: { key: "value" },
};
isEmpty(obj); // Returns false
isEmpty({}); // Returns true
Defined inβ
object.ts:34