From bac4291086d849ae485ccc3f21e24ce4b98c76f3 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 24 Jan 2017 10:44:22 -0800 Subject: [PATCH] Simplify `toPlainObject`. --- toPlainObject.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/toPlainObject.js b/toPlainObject.js index 511fe202a..18acd8067 100644 --- a/toPlainObject.js +++ b/toPlainObject.js @@ -1,6 +1,3 @@ -import copyObject from './.internal/copyObject.js'; -import keysIn from './keysIn.js'; - /** * Converts `value` to a plain object flattening inherited enumerable string * keyed properties of `value` to own properties of the plain object. @@ -24,7 +21,12 @@ import keysIn from './keysIn.js'; * // => { 'a': 1, 'b': 2, 'c': 3 } */ function toPlainObject(value) { - return copyObject(value, keysIn(value)); + value = Object(value); + const result = {}; + for (let key in value) { + result[key] = value[value]; + } + return result; } export default toPlainObject;