Skip to content

Latest commit

 

History

History
51 lines (31 loc) · 854 Bytes

object.md

File metadata and controls

51 lines (31 loc) · 854 Bytes

object

Internal library of helpers for manipulating objects.

Functions

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