From 4058b4895972d91713a89e4448b9b28fbf58c37c Mon Sep 17 00:00:00 2001 From: divlo Date: Mon, 26 Oct 2020 02:35:56 +0100 Subject: [PATCH] fix: delete Object.fromEntries ponyfill cause of bugs --- package-lock.json | 2 +- package.json | 2 +- src/fromEntries.ts | 9 --------- src/index.tsx | 3 +-- 4 files changed, 3 insertions(+), 13 deletions(-) delete mode 100644 src/fromEntries.ts diff --git a/package-lock.json b/package-lock.json index 19c339d..0f63b49 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-component-form", - "version": "1.2.0", + "version": "1.2.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 8c929e1..138b1b2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-component-form", - "version": "1.2.0", + "version": "1.2.1", "description": "Manage React Forms with ease.", "author": "Divlo ", "license": "MIT", diff --git a/src/fromEntries.ts b/src/fromEntries.ts deleted file mode 100644 index a2b44c1..0000000 --- a/src/fromEntries.ts +++ /dev/null @@ -1,9 +0,0 @@ -/*! fromentries. MIT License. Feross Aboukhadijeh */ -export function fromEntries( - iterable: Iterable -) { - return [...iterable].reduce((object, [key, value]) => { - object[key] = value - return object - }, {}) -} diff --git a/src/index.tsx b/src/index.tsx index de37889..a8456e2 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -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(new FormData(formElement)) + return Object.fromEntries(new FormData(formElement)) } const Form = (props: FormProps): JSX.Element => {