```coffeescript

module.exports.pad = (n, size) ->
    n = n.toString()
    pad = ''
    size = size - n.length
    for i in [0 .. size]
        pad += ' '
    n + pad

module.exports.flatten = (arr, ret) ->
  ret ?= []
  len = arr.length
  for i in [0 .. len]
    if Array.isArray arr[i]
      exports.flatten arr[i], ret
    else
      ret.push arr[i]
  ret```

Fix flatten function (bug introduce by coffee migration)
user
```coffeescript

path = require 'path'

module.exports =
    pad: (n, size) ->
        n = n.toString()
        pad = ''
        size = size - n.length
        for i in [0 .. size]
            pad += ' '
        n + pad
    flatten: (arr, ret) ->
        ret ?= []
        for i in [0 ... arr.length]
            if Array.isArray arr[i]
                @flatten arr[i], ret
            else
                ret.push arr[i]
        ret
    # Discovery the project root directory or return null if undiscoverable
    workspace: () ->
        dirs = require('module')._nodeModulePaths process.cwd()
        for dir in dirs
            if path.existsSync(dir) || path.existsSync(path.normalize(dir + '/../package.json'))
                return path.normalize dir + '/..'```
assistant