import * as is from "./guards"; import type { Entry, NumStr, PartialRecord, Rec, Writable, objectU, types } from "../types"; /** * Typed version of Object.assign. * @param target - Target. * @param sources - Sources. * @returns Target. */ export declare const assign: (target: Writable, ...sources: ReadonlyArray>>) => T; /** * Typed version of Object.defineProperty. * @param obj - Object. * @param key - Key. * @param descriptor - Descriptor. */ export declare const defineProperty: (obj: T, key: K, descriptor: Descriptor) => void; export declare const entries: { /** * Typed version of Object.entries. * @param obj - Object. * @returns Object entries. */ (obj: PartialRecord): ReadonlyArray>; /** * Typed version of Object.entries. * @param obj - Object. * @returns Object entries. */ (obj: T): ReadonlyArray>; }; export declare const fromEntries: ((entries: Iterable>) => PartialRecord) & Readonly<{ /** * Creates object from entries. * @param entries - Entries. * @returns Object. */ exhaustive: (entries: Iterable>) => Rec; }>; export declare const keys: { /** * Typed version of Object.keys. * @param obj - Object. * @returns Object keys. */ (obj: PartialRecord): readonly K[]; /** * Typed version of Object.keys. * @param obj - Object. * @returns Object keys. */ (obj: T): ReadonlyArray; }; export declare const values: { /** * Typed version of Object.values. * @param obj - Object. * @returns Object values. */ (obj: PartialRecord): readonly V[]; /** * Typed version of Object.values. * @param obj - Object. * @returns Object values. */ (obj: T): ReadonlyArray; }; export declare const removeUndefinedKeys: ((obj: types.object.style.OptionalUndefined) => T) & Readonly<{ /** * Removes undefined keys. * @param obj - Object. * @returns New object with undefined keys removed. */ alt: (obj: T) => types.object.style.Optional; }>; /** * Clones object. * @param obj - Object. * @returns New object. */ export declare function clone(obj: T): Writable; /** * Checks if every object property satisfies condition. * @param obj - Object. * @param predicate - Predicate. * @returns _True_ if every object property satisfies condition, _false_ otherwise. */ export declare function every(obj: T, predicate: Predicate): boolean; /** * Picks object entries by predicate. * @param obj - Object. * @param predicate - Predicate. * @returns New object. */ export declare function filter(obj: T, predicate: Predicate): Partial; /** * Returns object property. * @param obj - Object. * @param key - Key. * @returns Object property. */ export declare function get(obj: object, key: PropertyKey): unknown; /** * Returns object property. * @param obj - Object. * @param key - Key. * @param guard - Guard for type T. * @param defVal - Default value. * @returns Object property if its type is T. * @throws AssertionError otherwise. */ export declare function get(obj: object, key: PropertyKey, guard?: is.Guard, defVal?: T): T; /** * Returns object prototype. * @param obj - Object. * @returns Object prototype if available, _undefined_ otherwise. */ export declare function getPrototypeOf(obj: object): objectU; /** * Checks if object has property. * @param key - Key. * @param obj - Object. * @returns _True_ if object has property, _false_ otherwise. */ export declare function hasOwnProp(key: PropertyKey, obj: object): boolean; /** * Applies callback to each property. * @param obj - Object. * @param callback - Callback. * @returns New object. */ export declare function map(obj: Rec, callback: (value: V, key: K) => R): Rec; /** * Omit object entries by predicate. * @param obj - Object. * @param predicate - Predicate. * @returns New object. */ export declare function omit(obj: T, predicate: Predicate): Partial; /** * Removes keys from object. * @param obj - Object. * @param exclude - Keys to omit. * @returns New object. */ export declare function omitKeys & string>(obj: T, ...exclude: readonly K[]): T; /** * Removes keys from object. * @param obj - Object. * @param exclude - Keys to omit. * @returns New object. */ export declare function omitKeys(obj: T, ...exclude: readonly K[]): types.object.Omit; /** * Adds prefix to object keys. * @param obj - Object. * @param prefix - Prefix. * @returns Object with prefixed keys. */ export declare function prefixKeys(obj: T, prefix: P): PrefixKeys; /** * Sets object property. * @param obj - Object. * @param key - Key. * @param value - Value. */ export declare function set(obj: object, key: PropertyKey, value: unknown): void; /** * Returns the number of enumerable properties. * @param obj - Object. * @returns The number of enumerable properties. */ export declare function size(obj: object): number; /** * Checks if some object property satisfies condition. * @param obj - Object. * @param predicate - Predicate. * @returns _True_ if some object property satisfies condition, _false_ otherwise. */ export declare function some(obj: T, predicate: Predicate): boolean; /** * Sorts object. * @param obj - Object. * @param compareFn - Comparison function. * @returns New object. */ export declare function sort(obj: Rec, compareFn?: CompareFn>): Rec; /** * Sorts object. * @param obj - Object. * @param compareFn - Comparison function. * @returns New object. */ export declare function sort(obj: T, compareFn?: CompareFn): T; export interface CompareFn { /** * Compares two object entries. * @param value1 - Value 1. * @param value2 - Value 2. * @param key1 - Key 1. * @param key2 - Key 2. */ (value1: T[keyof T], value2: T[keyof T], key1: keyof T, key2: keyof T): number; } export interface Descriptor extends PropertyDescriptor { /** * Property getter. * @param this - This argument. * @returns Value. */ readonly get?: (this: T) => T[K]; /** * Property setter. * @param this - This argument. * @param value - New value. */ readonly set?: (this: T, value: T[K]) => void; readonly value?: T[K]; } export interface Predicate { /** * Checks object entry. * @param value - Value. * @param key - Key. * @returns _True_ if object entry passes check, _false_ otherwise. */ (value: T[keyof T], key: keyof T): boolean; } export type PrefixKeys = { [K in string & keyof T as `${P}${K}`]: T[K]; }; //# sourceMappingURL=object.d.ts.map