1
0
mirror of https://github.com/danog/gift.git synced 2024-11-26 20:04:47 +01:00

Use arguments.length to support prior calls to ls_files (#83)

This commit is contained in:
Luke Plaster 2016-07-06 14:50:42 +08:00
parent 951ba4c0b2
commit fbc63ff214

View File

@ -293,9 +293,11 @@ module.exports = class Repo
# callback - Receives `(err,stdout)`.
#
ls_files: (files, options, callback) ->
[options, callback] = [callback, options] if !callback
[files, callback] = [callback, files] if !callback
[files, options] = [options, files] if typeof files is 'object' and not _.isArray files
# support the old (options, callback) sig
if arguments.length < 3
[options, callback] = [files, options]
files = null
callback ?= ->
options ?= {}
files ?= ''
files = [files] if _.isString files