object-deep-compare
Version:
A type-safe collection of comparison methods for objects and arrays in TypeScript/JavaScript
44 lines (43 loc) • 1.52 kB
TypeScript
/**
* Core utility functions for object comparison
*/
/**
* Helper function to check if an object has a property
* @param obj - Object to check
* @param key - Property to check for
* @returns Whether the object has the property
*/
export declare const hasOwn: (obj: Record<string, any>, key: string) => boolean;
/**
* Helper function to check if a value is empty
* @param value - Value to check
* @returns Whether the value is empty
*/
export declare const isEmpty: (value: any) => boolean;
/**
* Helper function to check if a value is an object
* @param value - Value to check
* @returns Whether the value is an object
*/
export declare const isObject: (value: any) => boolean;
/**
* Helper function to determine if two values are equal
* @param a - First value
* @param b - Second value
* @param strict - Whether to use strict equality
* @returns Whether the values are equal
*/
export declare const areValuesEqual: (a: any, b: any, strict?: boolean) => boolean;
/**
* Creates a filtered copy of an object with only the specified keys
* @param obj - Object to filter
* @param keys - Keys to include in the result
* @returns A new object with only the specified keys
*/
export declare const pick: <T extends Record<string, any>>(obj: T, keys: string[]) => Record<string, any>;
/**
* Gets the type name of a value for better type information
* @param value - The value to get the type of
* @returns A string representing the type
*/
export declare const getTypeName: (value: unknown) => string;