directory-import
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "directory-import", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Module sync or async import(requires) all modules from the folder you specify.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -26,7 +26,7 @@ ##### Module sync or async import(requires) all modules from the folder you specify. | ||
// Simple loading of all modules inside the directory and in all its subdirectories | ||
importDir(`./someDir`, 'sync'); | ||
importDir(`../someDir`, 'sync'); | ||
// EX 2 | ||
// Loading and working with all modules inside the directory and in all its subdirectories | ||
importDir(`./someDir`, 'sync', (name, path, func) => { | ||
importDir(`../someDir`, 'sync', (name, path, func) => { | ||
console.info( | ||
@@ -39,19 +39,19 @@ `name: ${name} \n` + | ||
// name: someFile1 | ||
// path: ./someDir/someFile1.js | ||
// path: ../someDir/someFile1.js | ||
// func: () => console.info('this is some file 1') | ||
// | ||
// name: someFile2 | ||
// path: ./someDir/someFile2.js | ||
// path: ../someDir/someFile2.js | ||
// func: () => console.info('this is some file 2') | ||
// | ||
// name: config | ||
// path: ./someDir/config.json | ||
// path: ../someDir/config.json | ||
// func: [object Object] | ||
// | ||
// name: someModule1 | ||
// path: ./someDir/someSubDir/someModule1.js | ||
// path: ../someDir/someSubDir/someModule1.js | ||
// func: () => console.info('this is some module 1') | ||
// | ||
// name: someModule2 | ||
// path: ./someDir/someSubDir/someModule2.js | ||
// path: ../someDir/someSubDir/someModule2.js | ||
// func: () => console.info('this is some module 2') | ||
@@ -63,3 +63,3 @@ }); | ||
// However, modules load in order from fastest loaded to slowest loaded | ||
importDir(`./someDir`, 'async', (name, path, func) => { | ||
importDir(`../someDir`, 'async', (name, path, func) => { | ||
console.info( | ||
@@ -74,3 +74,3 @@ `name: ${name} \n` + | ||
// Loading and storing modules in the object | ||
const modulesSync = importDir(`./someDir`, 'sync'); | ||
const modulesSync = importDir(`../someDir`, 'sync'); | ||
@@ -89,3 +89,3 @@ console.info(modulesSync); | ||
// However, modules load in order from fastest loaded to slowest loaded | ||
const modulesAsync = importDir(`./someDir`, 'async'); | ||
const modulesAsync = importDir(`../someDir`, 'async'); | ||
@@ -99,3 +99,3 @@ | ||
```javascript | ||
const modules = importDir(`./someDir`, 'sync', (name, path, func) => { | ||
const modules = importDir(`../someDir`, 'sync', (name, path, func) => { | ||
console.info( | ||
@@ -108,19 +108,19 @@ `name: ${name} \n` + | ||
// name: someFile1 | ||
// path: ./someDir/someFile1.js | ||
// path: ../someDir/someFile1.js | ||
// func: () => console.info('this is some file 1') | ||
// | ||
// name: someFile2 | ||
// path: ./someDir/someFile2.js | ||
// path: ../someDir/someFile2.js | ||
// func: () => console.info('this is some file 2') | ||
// | ||
// name: config | ||
// path: ./someDir/config.json | ||
// path: ../someDir/config.json | ||
// func: [object Object] | ||
// | ||
// name: someModule1 | ||
// path: ./someDir/someSubDir/someModule1.js | ||
// path: ../someDir/someSubDir/someModule1.js | ||
// func: () => console.info('this is some module 1') | ||
// | ||
// name: someModule2 | ||
// path: ./someDir/someSubDir/someModule2.js | ||
// path: ../someDir/someSubDir/someModule2.js | ||
// func: () => console.info('this is some module 2') | ||
@@ -127,0 +127,0 @@ }); |
Sorry, the diff of this file is not supported yet
27474