Skip to content

Commit 446ff2d

Browse files
committed
Remove last dependency by es6-ing a line of code
1 parent 69639ae commit 446ff2d

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Diff for: index.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@
1111
'use strict';
1212

1313
var fs = require('fs');
14-
var toArray = require('lodash.toarray');
1514
var pathExists = fs.existsSync;
1615

1716
function isFunction(obj) {
1817
return typeof obj === 'function';
1918
}
2019

20+
function isObject(obj) {
21+
return typeof obj === 'object' && obj !== null && obj !== undefined;
22+
}
23+
2124
function extractMethods(methods) {
2225
return Array.isArray(methods) ?
2326
methods : Object.keys(methods).filter(function (method) {
@@ -27,7 +30,7 @@ function extractMethods(methods) {
2730

2831
function convertArgs(args) {
2932
if (args.length > 1) {
30-
return [toArray(args)];
33+
return [Array.from(args)];
3134
}
3235
var arg = args[0];
3336
return Array.isArray(arg) ? arg : [arg];
@@ -208,7 +211,7 @@ assert.notImplement = function (subject, methods) {
208211

209212
assert.objectContent = function (obj, content) {
210213
Object.keys(content).forEach(function (key) {
211-
if (_.isObject(content[key])) {
214+
if (isObject(content[key])) {
212215
assert.objectContent(obj[key], content[key]);
213216
return;
214217
}
@@ -225,7 +228,7 @@ assert.objectContent = function (obj, content) {
225228

226229
assert.noObjectContent = function (obj, content) {
227230
Object.keys(content).forEach(function (key) {
228-
if (_.isObject(content[key])) {
231+
if (isObject(content[key])) {
229232
assert.noObjectContent(obj[key], content[key]);
230233
return;
231234
}

Diff for: package.json

-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
"test": "gulp",
2424
"prepublish": "gulp prepublish"
2525
},
26-
"dependencies": {
27-
"lodash.toarray": "^4.4.0"
28-
},
2926
"devDependencies": {
3027
"eslint-config-xo-space": "^0.15.0",
3128
"gulp": "^3.9.0",

0 commit comments

Comments
 (0)