Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Contra
committed
Feb 7, 2018
1 parent
1da3990
commit 3d39752
Showing
8 changed files
with
137 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
npm-debug.log | ||
node_modules | ||
node_modules | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## 1.0.0 | ||
|
||
- mapValue option added | ||
- mapKey option added | ||
- filter option added | ||
- camelcase option removed, use mapKey to achieve the same functionality |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
{ "name": "require-dir" | ||
, "description": "Helper to require() directories." | ||
, "version": "0.3.2" | ||
, "author": "Aseem Kishore <aseem.kishore@gmail.com>" | ||
, "license": "MIT" | ||
, "dependencies": {} | ||
, "devDependencies": | ||
{ "coffee-script": "~1.3.3" | ||
, "mkdirp": "^0.5.0" | ||
, "ts-node": "^1.3.0" | ||
, "typescript": "^1.8.0" | ||
} | ||
, "engines": | ||
{ "node": "*" | ||
} | ||
, "scripts": | ||
{ "test": "node test" | ||
} | ||
, "homepage": "https://github.com/aseemk/requireDir" | ||
, "repository": | ||
{ "type": "git" | ||
, "url": "git://github.com/aseemk/requireDir.git" | ||
{ | ||
"name": "require-dir", | ||
"description": "Helper to require() directories.", | ||
"version": "1.0.0", | ||
"author": "Aseem Kishore <aseem.kishore@gmail.com>", | ||
"license": "MIT", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"coffee-script": "^1.3.3", | ||
"ts-node": "^1.3.0", | ||
"typescript": "^1.8.0" | ||
}, | ||
"engines": { | ||
"node": "*" | ||
}, | ||
"scripts": { | ||
"test": "node test" | ||
}, | ||
"homepage": "https://github.com/aseemk/requireDir", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/aseemk/requireDir.git" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
var assert = require('assert'); | ||
var requireDir = require('..'); | ||
|
||
var mapper = function(v, f) { | ||
return f.toUpperCase(); | ||
}; | ||
|
||
// first test without recursing: | ||
assert.deepEqual(requireDir('./recurse', { mapKey: mapper }), { | ||
A: 'a', | ||
}); | ||
|
||
// then test with recursing: | ||
assert.deepEqual(requireDir('./recurse', { recurse: true, mapKey: mapper }), { | ||
A: 'a', | ||
B: { | ||
'1': { | ||
FOO: 'foo', | ||
BAR: 'bar', | ||
}, | ||
'2': {} // note how the directory is always returned | ||
}, | ||
C: { | ||
'3': 3 | ||
}, | ||
// note that node_modules was explicitly ignored | ||
}); | ||
|
||
console.log('mapKey tests passed.'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
var assert = require('assert'); | ||
var requireDir = require('..'); | ||
|
||
var mapper = function(v, f) { | ||
if (typeof v === 'string') return v.toUpperCase(); | ||
return v; | ||
}; | ||
|
||
// first test without recursing: | ||
assert.deepEqual(requireDir('./recurse', { mapValue: mapper }), { | ||
a: 'A', | ||
}); | ||
|
||
// then test with recursing: | ||
assert.deepEqual(requireDir('./recurse', { recurse: true, mapValue: mapper }), { | ||
a: 'A', | ||
b: { | ||
'1': { | ||
foo: 'FOO', | ||
bar: 'BAR', | ||
}, | ||
'2': {} // note how the directory is always returned | ||
}, | ||
c: { | ||
'3': 3 | ||
}, | ||
// note that node_modules was explicitly ignored | ||
}); | ||
|
||
console.log('mapValue tests passed.'); |
3d39752
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic stuff! Thank you.
3d39752
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aseemk Sent you an email