Skip to content

Commit

Permalink
update README.md
Browse files Browse the repository at this point in the history
Signed-off-by: iswilljr <iswilljr@gmail.com>
  • Loading branch information
iswilljr committed Sep 6, 2022
1 parent 1b8364e commit c7d6d34
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ yarn add import-directories

## Usage

### Import Directory

```js
import { importDirectory } from "import-directories";

Expand Down Expand Up @@ -42,7 +44,7 @@ import { importDirectory } from "import-directories";
const foo = await importDirectory("./foo", { keepPathOnKey: true });

console.log(foo);
// => { "/home/user/foo/bar.js": { foobar: "arboof" } }
// => { "/home/user/foo/bar.js": { foobar: "raboof" } }
```

#### Prefix Key
Expand All @@ -53,8 +55,12 @@ import { importDirectory } from "import-directories";
const foo = await importDirectory("./foo", { prefixKey: "/foobar-app" });

console.log(foo);
// => {
// => {
// "/foobar-app/foo.js": { foo: "bar" }
// "/foobar-app/bar.js": { bar: "foo" }
// }
```

## Related

- [express-router-helpers](https://github.com/iswilljr/express-router-helpers) - create your route handlers easier and autoload routes
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "import-directories",
"version": "0.0.2",
"version": "0.0.3",
"description": "recursively imports all files in a directory",
"license": "MIT",
"author": "iswilljr <iswilljr@gmail.com>",
Expand Down

0 comments on commit c7d6d34

Please sign in to comment.