UNPKG

@bemedev/decompose

Version:
19 lines 901 B
import type { Decompose, Ru } from '../types.types'; import type { DEFAULT_OPTIONS } from './constants'; export type AssignByBey_F = <T extends Ru, D extends Decompose<T, typeof DEFAULT_OPTIONS>, K extends Extract<keyof D, string>, R extends D[K]>(obj: T, key: K, value: R) => T; export interface AssignByKey { (obj: any, key: string, value: any): any; low: (obj: any, key: string, value: any) => any; typed: AssignByBey_F; } /** * Assigns a value to a path in an object. * @param obj The object to assign the value to * @param path The key to assign the value to, can be a nested key (e.g. 'a.b.c') * @param value The value to assign to the key * @returns The modified object with the value assigned to the specified key * * @see {@linkcode Decompose} for more details on object decomposition. */ export declare const assignByKey: AssignByKey; //# sourceMappingURL=assign.d.ts.map