@ctrlo/mapper
v1.0.2
Published
Mapping library for form data and general use
Downloads
428
Readme
@ctrlo/mapper
Mapping library for form data and general use
Functions
map
Expected input format
The input object for the mapper is as follows:
{
error: number, // 1 or 0, depending on if there's an error
records: { // Input records
label: string,
id: number
}
}Function Usage
const result = map(input);Map the input to a pre-defined output format
Expected output format
{
name: string, // as given in the input records
id: number // as given in the input records
}[]formdataMapper
Maps a JSON/JavaScript object to a FormData object using the object keys as the data keys, and their values as the data values
const data = formdataMapper(input);