@bolttech/form-engine
Version:
A form engine based on form events for react projects
28 lines (27 loc) • 929 B
TypeScript
import Form from '@core/managers/Form';
import Field from '@core/managers/Field';
/**
* Encapsulates in a given object, at a given path the provided value
*
* @example
* ORIGINAL object
*
* encapsulateIn({maintain: 'spread_me'}, 'a.b.c','test')
*
* RESULT
*
* {
* maintain: 'spread_me',
* c: 'test
* }
* }
*
* @param origin - The original object where the new value will be appended
* @param path - The path at which the new value will be placed
* @param value - The new value
* @param form - The form instance to be used on extract string
* @param field - The field instance to be used on extract string
* @returns One new object with the new value at the provided path merged with the given object
*/
declare const encapsulateIn: (origin: Record<string, unknown>, path: string, value: string, form: Form, field: Field) => Record<string, unknown>;
export { encapsulateIn };