Skip to content

Commit

Permalink
[fix] ignore suffix. updated readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
calvintwr committed May 15, 2020
1 parent f0461b5 commit ca70e68
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Express Route-Magic v0.0.1
* Express Route-Magic v0.0.3
* (c) 2020 Calvin Tan
* Released under the MIT License.
*/
Expand Down Expand Up @@ -112,7 +112,7 @@ Magic.toIgnore = function (payload, isDirectory) {

let toIgnore = false
this.ignoreSuffix.forEach(suffix => {
if (payload.indexOf(suffix) !== -1 && payload.indexOf(suffix) !== payload.length - suffix.length) {
if (payload.indexOf(suffix) !== -1 && payload.indexOf(suffix) === payload.length - suffix.length) {
toIgnore = true
return null
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "express-routemagic",
"version": "0.0.2",
"version": "0.0.3",
"description": "A simple and fast module to automatically require all your express routes without bloating your code without `app.use('i/will/repeat/this', require('./i/will/repeat/this')`.",
"main": "index.js",
"scripts": {
Expand Down
10 changes: 5 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Route Magic

Route Magic is a simple and fast Nodejs module to abstract away the unnessary route invocations in the widely popular [Expressjs framework] (https://github.com/expressjs/express).
Route Magic is a simple and fast Nodejs module to abstract away the unnessary route invocations in the widely popular [Expressjs framework] (https://github.com/expressjs/express). This module has no dependencies.

## Say Goodbye To This

Expand All @@ -18,7 +18,7 @@ This is the most basic way to use Magic:

```js
const magic = require('express-routemagic')
magic.use(app, '[your route directory]')
magic.use(app, __dirname, '[your route directory]')
```

## Installation
Expand All @@ -30,7 +30,7 @@ npm install express-routemagic
## Options

```js
magic.use(app, {
magic.use(app, __dirname, {
routeFolder: './routes', // Mandatory
debug: [ your own debug module ], // Optional
printRoutes: true, // Optional. This prints out all your routes. If no debug module is passed, it uses console.log by default
Expand All @@ -44,7 +44,7 @@ magic.use(app, {
```js
const debug = require('debug')('your:namespace:magic')

magic.use(app, {
magic.use(app, __dirname, {
routeFolder: './routes',
debug: debug,
printRoutes: true,
Expand All @@ -55,7 +55,7 @@ magic.use(app, {
You can also pass an array to `ignoreSuffix`:

```js
magic.use(app, {
magic.use(app, __dirname, {
ignoreSuffix: ['_bak', '_old', '_dev']
})
```
Expand Down

0 comments on commit ca70e68

Please sign in to comment.