Skip to main content

object

Internal library of helpers for manipulating objects.

isEmpty()

function isEmpty<T>(obj): obj is Exclude<unknown, T>

Defined in: object.ts:34

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