Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github.com:tblobaum/node-directory

  • Loading branch information...
commit 9ca633087751b9929a7f30113d24ee1269c5d5eb 2 parents 7d6035e + 06bb970
@tblobaum authored
Showing with 10 additions and 22 deletions.
  1. +10 −22 README.md
View
32 README.md
@@ -1,35 +1,23 @@
-node-directory
-=========
-A simple module to require all files and directories inside a directory. By
-default it requires all files in the current directory except itself, and maps
-them to a callback.
+# node-directory
+require all files and directories inside a directory
-Example
--------
-
-As an example, this may be your index.js file in a directory that contains all
-of the schemas for your models. The call to directory will require all of the
-(other) files in the current directory and loop through them.
+## Example
+As an example, this may be your index.js file in a directory
```javascript
-module.exports = function (models, options) {
- options = options || { debug:false }
-
- require('directory')(function (module, name) {
- models.model(name, module, options)
- })
-
-}
+require('directory')(function (module, name) {
+ exports[name] = module
+})
````
-Require a different directory:
+Or require a different directory
```javascript
require('directory')(__dirname + '/plugins/', function (module, name) {
- models.plugin(module, options)
+ exports[name] = module
})
````
@@ -37,7 +25,7 @@ require('directory')(__dirname + '/plugins/', function (module, name) {
Installation
------------
- npm install directory --save
+ npm install directory
Usage
-----
Please sign in to comment.
Something went wrong with that request. Please try again.