export-dirs
Advanced tools
Comparing version 0.2.0 to 0.2.1
{ | ||
"name": "export-dirs", | ||
"description": "Export directories and their files as node.js modules.", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"homepage": "https://github.com/jonschlinkert/export-dirs", | ||
@@ -35,4 +35,4 @@ "author": { | ||
"devDependencies": { | ||
"mocha": "^2.2.1", | ||
"should": "^5.2.0" | ||
"mocha": "*", | ||
"should": "*" | ||
}, | ||
@@ -47,2 +47,2 @@ "keywords": [ | ||
] | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# export-dirs [![NPM version](https://badge.fury.io/js/export-dirs.svg)](http://badge.fury.io/js/export-dirs) [![Build Status](https://travis-ci.org/jonschlinkert/export-dirs.svg)](https://travis-ci.org/jonschlinkert/export-dirs) | ||
# export-dirs [![NPM version](https://badge.fury.io/js/export-dirs.svg)](http://badge.fury.io/js/export-dirs) | ||
@@ -13,71 +13,13 @@ > Export directories and their files as node.js modules. | ||
Pass the directory as the only argument: | ||
```js | ||
module.exports = require('export-dirs')(__dirname); | ||
var exportDirs = require('export-dirs'); | ||
``` | ||
**Example**: | ||
## API | ||
<!-- add a path or glob pattern for files with code comments to use for docs --> | ||
{%= apidocs("index.js") %} | ||
Given the following [directory structure](./fixtures/): | ||
``` | ||
fixtures/ | ||
one/ | ||
a.js | ||
b.js | ||
c.js | ||
// use `export-files` in this index.js | ||
index.js | ||
two/ | ||
d.js | ||
e.js | ||
f.js | ||
// use `export-files` in this index.js | ||
index.js | ||
three/ | ||
g.js | ||
h.js | ||
i.js | ||
// use `export-files` in this index.js | ||
index.js | ||
x.js | ||
y.js | ||
z.js | ||
// use `export-dirs` in this index.js | ||
index.js | ||
``` | ||
The result would be: | ||
```js | ||
// all modules are flattened onto the `_` object | ||
{ _: | ||
{ z: [Function], | ||
y: [Function], | ||
x: [Function], | ||
f: [Function], | ||
e: [Function], | ||
d: [Function], | ||
i: [Function], | ||
h: [Function], | ||
g: [Function], | ||
c: [Function], | ||
b: [Function], | ||
a: [Function] }, | ||
// files from the same directory as export-dirs | ||
z: [Function], | ||
y: [Function], | ||
x: [Function], | ||
// directory names and the files in each exposed as modules | ||
two: { f: [Function], e: [Function], d: [Function] }, | ||
three: { i: [Function], h: [Function], g: [Function] }, | ||
one: { c: [Function], b: [Function], a: [Function] } } | ||
``` | ||
## Related projects | ||
* [to-exports](https://github.com/jonschlinkert/to-exports): Create exports from a directory of non-javascript or javascript files. | ||
* [export-files](https://github.com/jonschlinkert/export-files): node.js utility for exporting a directory of files as modules. | ||
* [map-files](https://github.com/jonschlinkert/map-files): Return an object for a glob of files. Pass a `rename` function for the keys, or a `parse` function for the content, allowing it to be used for readable or require-able files. | ||
* [file-reader](https://github.com/jonschlinkert/file-reader): Read a glob of files, dynamically choosing the reader or requiring the files based on the file extension. | ||
<!-- add an array of related projects, then un-escape the helper --> | ||
{%= related([]) %} | ||
@@ -84,0 +26,0 @@ ## Running tests |
Sorry, the diff of this file is not supported yet
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
4592
48