Skip to content

Commit

Permalink
Allow top level object not to be a plain object
Browse files Browse the repository at this point in the history
  • Loading branch information
sttk committed Apr 13, 2017
1 parent 6923bc6 commit 8a1beb9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var isPlainObject = require('is-plain-object');
var objectAssign = require('object-assign');

module.exports = function(obj, fn, opts) {
if (!isPlainObject(obj)) {
if (!isObject(obj)) {
return;
}

Expand Down Expand Up @@ -50,3 +50,8 @@ function forEachChild(node, baseKey, fn, depth, opts) {
forEachChild(value, keyChain, fn, depth, opts);
}
}

function isObject(v) {
return Object.prototype.toString.call(v) === '[object Object]'
}

0 comments on commit 8a1beb9

Please sign in to comment.