remix-hook-form
Advanced tools
Comparing version 3.1.0 to 3.2.0
// src/utilities/index.ts | ||
var tryParseJSON = (jsonString) => { | ||
if (jsonString === "null") { | ||
return null; | ||
} | ||
if (jsonString === "undefined") { | ||
return void 0; | ||
} | ||
try { | ||
const json = JSON.parse(jsonString); | ||
if (typeof json === "object" || typeof json === "boolean" || typeof json === "string") { | ||
return json; | ||
} | ||
return jsonString; | ||
return json; | ||
} catch (e) { | ||
@@ -79,15 +70,6 @@ return jsonString; | ||
Object.entries(data).map(([key, value]) => { | ||
if (Array.isArray(value)) { | ||
formData.append(key, JSON.stringify(value)); | ||
} else if (value instanceof File || value instanceof Blob) { | ||
if (value instanceof File || value instanceof Blob) { | ||
formData.append(key, value); | ||
} else if (typeof value === "object" && value !== null) { | ||
} else | ||
formData.append(key, JSON.stringify(value)); | ||
} else if (typeof value === "boolean") { | ||
formData.append(key, value.toString()); | ||
} else if (typeof value === "number") { | ||
formData.append(key, value.toString()); | ||
} else { | ||
formData.append(key, value); | ||
} | ||
}); | ||
@@ -94,0 +76,0 @@ return formData; |
{ | ||
"name": "remix-hook-form", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "Utility wrapper around react-hook-form for use with Remix.run", | ||
@@ -5,0 +5,0 @@ "type": "module", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47710
601