UNPKG

nhb-toolbox

Version:

A versatile collection of smart, efficient, and reusable utility functions, classes and types for everyday development needs.

12 lines (11 loc) 678 B
import type { GenericObject } from '../object/types'; import type { FormDataConfigs } from './types'; /** * * Utility to convert object into FormData in a controlled way. * - **N.B.** Be cautious when using this in SSR (Server-Side Rendering) environments (such as `Next.js` Server Components), as it may not work as expected. * * @param data - The source object to control and convert to FormData. * @param configs - Configuration options to control the formData. * @returns `FormData` instance containing the sanitized and transformed data. */ export declare const createControlledFormData: <T extends GenericObject>(data: T, configs?: FormDataConfigs<T>) => FormData;