Skip to content

Commit

Permalink
Fixed broken code in empty options check.
Browse files Browse the repository at this point in the history
  • Loading branch information
alinex committed Jul 5, 2014
1 parent 82aabe4 commit a099fca
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/copy.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ copy = module.exports.async = (source, target, options, cb, depth = 0) ->
return cb err if err
async.each files, (file, cb) ->
copy path.join(source, file), path.join(target, file), options, cb, depth
, cb
, cb

# Copy file or directory (Synchronous)
# -------------------------------------------------
Expand Down
5 changes: 3 additions & 2 deletions src/filter.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ util = require 'util'
# * `callback(success)`
# The callback will be called with a boolean value showing if file is accepted.
module.exports.async = (file, depth, options = {}, cb = -> ) ->
return cb true unless options? and options.length
return cb true unless options? and Object.keys(options).length
debug "check #{file} for " + util.inspect options
# console.log "check #{file} for " + util.inspect options
async.parallel [
(cb) -> skipDepth file, depth, options, cb
(cb) -> skipPath file, options, cb
Expand Down Expand Up @@ -61,7 +62,7 @@ module.exports.async = (file, depth, options = {}, cb = -> ) ->
#
# The options are the same as in the asynchronous method.
module.exports.sync = (file, depth, options = {}) ->
return true unless options? and options.length
return true unless options? and Object.keys(options).length
debug "check #{file} for " + util.inspect options
return false if skipTypeSync file, options
return false if skipDepthSync file, depth, options
Expand Down
2 changes: 1 addition & 1 deletion test/mocha/filter-type.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fs = require 'fs'

describe "Type filtering", ->

filter = require '../../lib/filter'
filter = require '../../src/filter'

files = [
'test/temp/file1'
Expand Down

0 comments on commit a099fca

Please sign in to comment.