1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-03 10:40:06 +00:00

fix(special-missings): fix convertToCSV format object

This commit is contained in:
Yury Shkoda
2022-02-16 17:13:00 +03:00
parent 4026b03005
commit d3dff44918
2 changed files with 5 additions and 2 deletions

View File

@@ -5,8 +5,11 @@ export const generateFileUploadForm = (
data: any
): FormData => {
for (const tableName in data) {
if (!Array.isArray(data[tableName])) continue
const name = tableName
const csv = convertToCSV(data[tableName])
if (csv === 'ERROR: LARGE STRING LENGTH') {
throw new Error(
'The max length of a string value in SASjs is 32765 characters.'

View File

@@ -3,7 +3,7 @@
* @param data - the array of JSON objects to convert.
*/
export const convertToCSV = (
data: any,
data: Array<any>,
sasFormats?: { formats: { [key: string]: string } }
) => {
let formats = sasFormats?.formats
@@ -76,7 +76,7 @@ export const convertToCSV = (
return byteSize
}
})
.sort((a: number, b: number) => b - a)[0]
.sort((a: any, b: any) => b - a)[0]
if (longestValueForField && longestValueForField > 32765) {
invalidString = true