Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

moved to lib

  • Loading branch information...
commit d64811c4a7c15dee2b263da47676a44693709ef5 1 parent 332e18b
@tblobaum authored
Showing with 34 additions and 31 deletions.
  1. +1 −1  README.md
  2. +1 −30 index.js
  3. +32 −0 lib/directory.js
View
2  README.md
@@ -28,7 +28,7 @@ Require a different directory:
```javascript
-require('directory')(__dirname + '/plugins', function (module, name) {
+require('directory')(__dirname + '/plugins/', function (module, name) {
models.plugin(module, options)
})
View
31 index.js
@@ -1,30 +1 @@
-
-/*!
- * node-directory
- * Copyright(c) Thomas Blobaum
- * MIT Licensed
- */
-
-module.exports = function modulate(dirname, callback) {
-
- if (!callback) {
- var callback = dirname
- }
-
- if (typeof dirname == 'function') {
- var dirname = module.parent.paths[0].split("node_modules")[0]
- }
-
-
- var paths = require('findit').sync(dirname)
-
- paths.forEach(function (path) {
- if (!path.match(module.parent.id)) {
- var filename = path.split(dirname)[1].split(".js")[0]
- callback(require(path), filename)
- }
- })
-
- delete require.cache[__filename]
-}
-
+module.exports = require('./lib/directory')
View
32 lib/directory.js
@@ -0,0 +1,32 @@
+
+/*!
+ * node-directory
+ * Copyright(c) Thomas Blobaum
+ * MIT Licensed
+ */
+
+function modulate (dirname, callback) {
+
+ if (!callback) {
+ var callback = dirname
+ }
+
+ if (typeof dirname == 'function') {
+ var dirname = module.parent.paths[0].split("node_modules")[0]
+ }
+
+
+ var paths = require('findit').sync(dirname)
+
+ paths.forEach(function (path) {
+ if (!path.match(module.parent.id)) {
+ var filename = path.split(dirname)[1].split(".js")[0]
+ callback(require(path), filename)
+ }
+ })
+
+ delete require.cache[__filename]
+}
+
+module.exports = modulate
+
Please sign in to comment.
Something went wrong with that request. Please try again.