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

@@ -17,8 +17,10 @@
* // => [5, 10]
*/
function filterObject(object, predicate) {
object = Object(object)
const result = []
Object.keys(Object(object)).forEach((key) => {
Object.keys(object).forEach((key) => {
const value = object[key]
if (predicate(value, key, object)) {
result.push(value)