decode-formdata
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -29,3 +29,3 @@ // src/utils/getFieldDate/getFieldDate.ts | ||
if (info?.booleans?.includes(templateName)) { | ||
return true; | ||
return value !== "false" && value !== "0"; | ||
} | ||
@@ -32,0 +32,0 @@ if (typeof value === "string") { |
/** | ||
* Returns the decoded date of a form field. | ||
* Returns the decoded date of a field. | ||
* | ||
* @param value The form field value. | ||
* @param value The field value. | ||
* | ||
@@ -30,3 +30,3 @@ * @returns The decoded date. | ||
*/ | ||
declare function getFieldValue(info: FormDataInfo | undefined, templateName: string, value: FormDataEntryValue): number | true | Date | FormDataEntryValue; | ||
declare function getFieldValue(info: FormDataInfo | undefined, templateName: string, value: FormDataEntryValue): number | boolean | Date | FormDataEntryValue; | ||
@@ -33,0 +33,0 @@ /** |
@@ -29,3 +29,3 @@ // src/utils/getFieldDate/getFieldDate.ts | ||
if (info?.booleans?.includes(templateName)) { | ||
return true; | ||
return value !== "false" && value !== "0"; | ||
} | ||
@@ -32,0 +32,0 @@ if (typeof value === "string") { |
{ | ||
"name": "decode-formdata", | ||
"description": "Decodes complex FormData into a JavaScript object", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "author": "Fabian Hiller", |
@@ -20,3 +20,3 @@ # Decode FormData | ||
```js | ||
```ts | ||
import { decode } from 'decode-formdata'; | ||
@@ -66,3 +66,3 @@ ``` | ||
```js | ||
```ts | ||
const formEntries = [ | ||
@@ -87,3 +87,3 @@ ['title', 'Red apple'], | ||
```js | ||
```ts | ||
import { decode } from 'decode-formdata'; | ||
@@ -106,3 +106,3 @@ | ||
```js | ||
```ts | ||
const formValues = { | ||
@@ -109,0 +109,0 @@ title: 'Red apple', |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
25894