Fix object coercion.

This commit is contained in:
John-David Dalton
2017-04-16 15:30:42 -05:00
parent e2941dda3b
commit aa5e1b2fe0
7 changed files with 20 additions and 10 deletions

View File

@@ -11,11 +11,12 @@ const hasOwnProperty = Object.prototype.hasOwnProperty
* @returns {Array} Returns the array of property names.
*/
function baseKeys(object) {
object = Object(object)
if (!isPrototype(object)) {
return Object.keys(Object(object))
return Object.keys(object)
}
const result = []
for (const key in Object(object)) {
for (const key in object) {
if (hasOwnProperty.call(object, key) && key != 'constructor') {
result.push(key)
}