 			[{}, options]
 		else
 			[options ? {}, fn]
+
+	# this method calls the given callback for each item in the collection, then calls
+	# the "done" method once each callback has called their given "done" methods
+	callbackForEach = (collection, done, callback) ->
+		[total, current] = [collection.length, 0]
+		do callbackCurrent = ->
+			item = collection[current]
+			called = false
+			callback item, current, (error) ->
+				console.error(error) if error?
+				unless called
+					called = true
+					if ++current >= total
+						done()
+					else
+						callbackCurrent()

		commenter = CodeCat.Commenters[ext]
		if commenter? then regexpEscape(commenter) else ''

	joinFiles = (paths, encoding, separator, stream) ->
		paths.forEach (path, notFirst) ->
			output = (notFirst and separator) or ''
			output += readFileSync(path, encoding: encoding)
			stream.write(output)

	ensureStream = (dest, options, fn) ->
		[options, fn] = discernOptions(options, fn)
		if isString(dest)
			stream = createWriteStream(dest, options)
			stream.once('open', -> fn(stream))
		else
			fn(dest)

	mapConcats = (concats, map, thisArg) ->
		mapped = {}

		Object.defineProperties this,
			source:
				value: source
			options:
				value: options
			prefix:
				value: prefix
			commenter:
