Skip to content

Commit

Permalink
Simplify argument type checks
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechilds committed Oct 7, 2016
1 parent f6b5e9f commit 5dfb5da
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ const protectedproperties = (() => {
.filter(prop => global[prop]);
})();

const getType = val => Object.prototype.toString.call(val);

module.exports = (...args) => {
const properties = args.filter(arg => getType(arg) === '[object Array]')[0];
const userJsdomConfig = args.filter(arg => getType(arg) === '[object Object]')[0];
const properties = args.filter(arg => Array.isArray(arg))[0];
const userJsdomConfig = args.filter(arg => !Array.isArray(arg))[0];

const jsdomConfig = Object.assign({}, userJsdomConfig, defaultJsdomConfig);

Expand Down

0 comments on commit 5dfb5da

Please sign in to comment.