use underscore to exclude file and directories

i have a node.js / express application that uses i18next for the localization of the site.

currently i am pulling the list for this from a hard coded version: https://github.com/TZM/tzm-blade/blob/master/app/config/apps.coffee#L105 but would like to make this list up by reading the locales directory and then making up the list from that.

i would like to basically exclude the dev, README.md and config.json from being returned and just have the other directories so that i can then return the correct country local for example using the node-cldr library to extract the language display name as per https://github.com/papandreou/node-cldr#cldrextractlanguagedisplaynameslocaleidroot:

☺  node  ruby-2.0.0-p195 master 2253522""
> var cldr = require('cldr');
undefined
> cldr.extractLanguageDisplayNames('ru').ru;
'русский'
>

etc...

so far looking at the reject http://underscorejs.org/#reject collection i don't see how to remove these files and directories

  fs.readdir "./locales", (err,locales) ->
    results = []
    __.reject locales, (value, index, list) ->
      console.log value, index, list
      results.push value
    console.log results

any advice much appreciated on how best to do this using the reject function in underscore.

I'm not too familiar with coffeescript, but here's what you'd want (might require fixing up, as I don't know coffeescript):

EXCLUDE = [ 'dev', 'README.md', 'config.json' ]
results = __.reject locales, (value, index, list) ->
  return EXCLUDE.indexOf(value) == -1

_.reject returns a new list of any items that the iterator returns true for. In this case, if the item is not in the EXCLUDE list (indexOf === -1), the function returns true, and that item is part of the list it returns.