From 446ff2d81e17f5f4258f973f43b9e7ad44dcd342 Mon Sep 17 00:00:00 2001 From: Simon Boudrias Date: Sat, 11 Feb 2017 22:32:45 +0800 Subject: [PATCH] Remove last dependency by es6-ing a line of code --- index.js | 11 +++++++---- package.json | 3 --- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index bad2eb6..acb1ba1 100644 --- a/index.js +++ b/index.js @@ -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) { @@ -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]; @@ -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; } @@ -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; } diff --git a/package.json b/package.json index c8a0eee..82412e9 100644 --- a/package.json +++ b/package.json @@ -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",