1.0.3 • Published 7 years ago

require-dirs v1.0.3

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

require directory

function(dir,options)

  • dir {String} is the directory path
  • options {Object}
    • exclude: {String} RegExp pattern, exclude module which name match reg rules
    • case: {String} The object field style. the value range {camel, snake, kebab ,capitalized). (default camel)
    • depth: {Number} limit the sub-directory search depth (default Number.MAX_VALUE)

example

The directory structure

├── fish.js
├── folder_with_index
│ ├── index.js
│ └── other_file.js
├── other_file.js
└── other_folder
├── badger.js
└── badger_fish.js

result

{
    fish: require("./fish"),
    folderWithIndex: {
        index:require("./folder_with_index/index"),
        otherFile:require("./folder_with_index/other_file"),
    },
    otherFile: require("./other_file"),
    otherFolder: {
        badger: require("./other_folder/badger"),
        badgerFish: require("./other_folder/badger_fish")
    }
}
1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago