require-dir
Advanced tools
Comparing version 0.2.0 to 0.3.0
17
index.js
@@ -123,3 +123,20 @@ // requireDir.js | ||
if (opts.camelcase) { | ||
for (var base in map) { | ||
// protect against enumerable object prototype extensions: | ||
if (!map.hasOwnProperty(base)) { | ||
continue; | ||
} | ||
map[toCamelCase(base)] = map[base]; | ||
} | ||
} | ||
return map; | ||
}; | ||
function toCamelCase(str) { | ||
return str.replace(/[_-][a-z]/ig, function (s) { | ||
return s.substring(1).toUpperCase(); | ||
}); | ||
} |
{ "name": "require-dir" | ||
, "description": "Helper to require() directories." | ||
, "version": "0.2.0" | ||
, "version": "0.3.0" | ||
, "author": "Aseem Kishore <aseem.kishore@gmail.com>" | ||
@@ -5,0 +5,0 @@ , "license": "MIT" |
@@ -63,2 +63,6 @@ [![Build Status](https://travis-ci.org/aseemk/requireDir.svg?branch=master)](https://travis-ci.org/aseemk/requireDir) | ||
`camelcase`: Automatically add camelcase aliases for files with dash- and | ||
underscore-separated names. E.g. `foo-bar.js` will be exposed under both the | ||
original `'foo-bar'` name as well as a `'fooBar'` alias. Default is false. | ||
`duplicates`: By default, if multiple files share the same basename, only the | ||
@@ -65,0 +69,0 @@ highest priority one is `require()`'d and returned. (Priority is determined by |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13060
32
235
118