11
11
'use strict' ;
12
12
13
13
var fs = require ( 'fs' ) ;
14
- var toArray = require ( 'lodash.toarray' ) ;
15
14
var pathExists = fs . existsSync ;
16
15
17
16
function isFunction ( obj ) {
18
17
return typeof obj === 'function' ;
19
18
}
20
19
20
+ function isObject ( obj ) {
21
+ return typeof obj === 'object' && obj !== null && obj !== undefined ;
22
+ }
23
+
21
24
function extractMethods ( methods ) {
22
25
return Array . isArray ( methods ) ?
23
26
methods : Object . keys ( methods ) . filter ( function ( method ) {
@@ -27,7 +30,7 @@ function extractMethods(methods) {
27
30
28
31
function convertArgs ( args ) {
29
32
if ( args . length > 1 ) {
30
- return [ toArray ( args ) ] ;
33
+ return [ Array . from ( args ) ] ;
31
34
}
32
35
var arg = args [ 0 ] ;
33
36
return Array . isArray ( arg ) ? arg : [ arg ] ;
@@ -208,7 +211,7 @@ assert.notImplement = function (subject, methods) {
208
211
209
212
assert . objectContent = function ( obj , content ) {
210
213
Object . keys ( content ) . forEach ( function ( key ) {
211
- if ( _ . isObject ( content [ key ] ) ) {
214
+ if ( isObject ( content [ key ] ) ) {
212
215
assert . objectContent ( obj [ key ] , content [ key ] ) ;
213
216
return ;
214
217
}
@@ -225,7 +228,7 @@ assert.objectContent = function (obj, content) {
225
228
226
229
assert . noObjectContent = function ( obj , content ) {
227
230
Object . keys ( content ) . forEach ( function ( key ) {
228
- if ( _ . isObject ( content [ key ] ) ) {
231
+ if ( isObject ( content [ key ] ) ) {
229
232
assert . noObjectContent ( obj [ key ] , content [ key ] ) ;
230
233
return ;
231
234
}
0 commit comments