fix: delete Object.fromEntries ponyfill cause of bugs

This commit is contained in:
divlo 2020-10-26 02:35:56 +01:00
parent 1601626fd9
commit 4058b48959
4 changed files with 3 additions and 13 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "react-component-form",
"version": "1.2.0",
"version": "1.2.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "react-component-form",
"version": "1.2.0",
"version": "1.2.1",
"description": "Manage React Forms with ease.",
"author": "Divlo <contact@divlo.fr>",
"license": "MIT",

View File

@ -1,9 +0,0 @@
/*! fromentries. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
export function fromEntries<T = any>(
iterable: Iterable<readonly [PropertyKey, T]>
) {
return [...iterable].reduce((object, [key, value]) => {
object[key] = value
return object
}, {})
}

View File

@ -1,5 +1,4 @@
import React, { useRef } from 'react'
import { fromEntries } from './fromEntries'
export interface FormDataObject {
[key: string]: FormDataEntryValue
@ -19,7 +18,7 @@ interface FormProps extends ReactFormProps {
}
const getFormDataObject = (formElement: HTMLFormElement): FormDataObject => {
return fromEntries<FormDataEntryValue>(new FormData(formElement))
return Object.fromEntries<FormDataEntryValue>(new FormData(formElement))
}
const Form = (props: FormProps): JSX.Element => {