Skip to content
This repository was archived by the owner on Dec 29, 2020. It is now read-only.

Commit aa8ec81

Browse files
committed
Use lodash isEmpty method instead of our own implementation
1 parent 044e67c commit aa8ec81

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

tasks/lib/jscs.js

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,14 @@
33
var Checker = require( "jscs" ),
44
jscsConfig = require( "jscs/lib/cli-config" ),
55

6-
assign = require( "lodash" ).assign,
6+
_ = require( "lodash" ),
77
hooker = require( "hooker" );
88

99
exports.init = function( grunt ) {
1010

1111
// Task specific options
1212
var taskOptions = [ "config", "force", "reporter", "reporterOutput" ];
1313

14-
/**
15-
* @see jQuery.isEmptyObject
16-
* @private
17-
*/
18-
function isEmptyObject( obj ) {
19-
var name;
20-
21-
for ( name in obj ) {
22-
return false;
23-
}
24-
25-
return true;
26-
}
27-
2814
/**
2915
* Default reporter
3016
* @private
@@ -81,11 +67,11 @@ exports.init = function( grunt ) {
8167

8268
// If the config option is null, but we have inline options,
8369
// we'll only use them as our config.
84-
if ( configOption == null && !isEmptyObject( options ) ) {
70+
if ( configOption == null && !_.isEmpty( options ) ) {
8571
config = options;
8672

8773
} else {
88-
assign( config, options );
74+
_.assign( config, options );
8975
}
9076

9177
this.throwForConfig( config );
@@ -100,7 +86,7 @@ exports.init = function( grunt ) {
10086
JSCS.prototype.throwForConfig = function( config ) {
10187
var configOption = this.options.config;
10288

103-
if ( isEmptyObject( config ) ) {
89+
if ( _.isEmpty( config ) ) {
10490
if ( configOption && typeof configOption === "string" ) {
10591
if ( grunt.file.exists( configOption ) ) {
10692
grunt.fatal( "\"" + configOption + "\" config is empty" );

0 commit comments

Comments
 (0)