troygoode / node-require-directory

Recursively iterates over specified directory, requiring each file, and returning a nested hash structure containing those libraries.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

File and directory with the same name (merge root with children)

slavafomin opened this issue · comments

Hello!

Thank you for this great module!

However, consider please the following scenario:

  • config/integration.js
  • config/integration/facebook.js
  • config/integration/google.js
  • config/integration/twitter.js
// integration.js
module.exports = {
  timeout: 30000,
  maxRequestsPerSec: 10
};
// integration/facebook.js
module.exports = {
  clientId: '...',
  secret: '...'
};

I want root integration.js to be merged with all children, i.e. facebook.js etc, to look like:

{
  timeout: 30000,
  maxRequestsPerSec: 10,
  facebook: {
    clientId: '...',
    secret: '...'
  },
  // ...
}

Is it possible right now? Are you planning to implement it?

Thank you!