Skip to content

Commit

Permalink
Remove last dependency by es6-ing a line of code
Browse files Browse the repository at this point in the history
  • Loading branch information
SBoudrias committed Feb 11, 2017
1 parent 69639ae commit 446ff2d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
11 changes: 7 additions & 4 deletions index.js
Expand Up @@ -11,13 +11,16 @@
'use strict';

var fs = require('fs');
var toArray = require('lodash.toarray');
var pathExists = fs.existsSync;

function isFunction(obj) {
return typeof obj === 'function';
}

function isObject(obj) {
return typeof obj === 'object' && obj !== null && obj !== undefined;
}

function extractMethods(methods) {
return Array.isArray(methods) ?
methods : Object.keys(methods).filter(function (method) {
Expand All @@ -27,7 +30,7 @@ function extractMethods(methods) {

function convertArgs(args) {
if (args.length > 1) {
return [toArray(args)];
return [Array.from(args)];
}
var arg = args[0];
return Array.isArray(arg) ? arg : [arg];
Expand Down Expand Up @@ -208,7 +211,7 @@ assert.notImplement = function (subject, methods) {

assert.objectContent = function (obj, content) {
Object.keys(content).forEach(function (key) {
if (_.isObject(content[key])) {
if (isObject(content[key])) {
assert.objectContent(obj[key], content[key]);
return;
}
Expand All @@ -225,7 +228,7 @@ assert.objectContent = function (obj, content) {

assert.noObjectContent = function (obj, content) {
Object.keys(content).forEach(function (key) {
if (_.isObject(content[key])) {
if (isObject(content[key])) {
assert.noObjectContent(obj[key], content[key]);
return;
}
Expand Down
3 changes: 0 additions & 3 deletions package.json
Expand Up @@ -23,9 +23,6 @@
"test": "gulp",
"prepublish": "gulp prepublish"
},
"dependencies": {
"lodash.toarray": "^4.4.0"
},
"devDependencies": {
"eslint-config-xo-space": "^0.15.0",
"gulp": "^3.9.0",
Expand Down

0 comments on commit 446ff2d

Please sign in to comment.