koa-lowercase
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -1,1 +0,1 @@ | ||
'use strict';require('babel-register')({babelrc:false,presets:[require('babel-preset-latest')],plugins:[require('babel-plugin-transform-es2015-modules-commonjs'),require('babel-plugin-transform-async-to-generator')]});require('babel-polyfill');module.exports=require('./src'); | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var lowercase=function lowercase(ctx,next){if(/[A-Z]/.test(ctx.url)){ctx.status=301;ctx.redirect(ctx.url.toLowerCase())}else{return next()}};exports.default=lowercase; |
20
index.js
@@ -1,10 +0,10 @@ | ||
require('babel-register')({ | ||
babelrc: false | ||
, presets: [ require('babel-preset-latest') ] | ||
, plugins: [ | ||
require('babel-plugin-transform-es2015-modules-commonjs') | ||
, require('babel-plugin-transform-async-to-generator') | ||
] | ||
}) | ||
require('babel-polyfill') | ||
module.exports = require('./src') | ||
const lowercase = (ctx, next) => { | ||
if (/[A-Z]/.test(ctx.url)) { | ||
ctx.status = 301 | ||
ctx.redirect(ctx.url.toLowerCase()) | ||
} else { | ||
return next() | ||
} | ||
} | ||
export default lowercase |
{ | ||
"name": "koa-lowercase", | ||
"description": "Simple lowercasing middleware for Koa 2.", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"author": { | ||
@@ -31,7 +31,4 @@ "name": "Zac Anger", | ||
"babel-cli": "^6.22.2", | ||
"babel-plugin-transform-async-to-generator": "^6.22.0", | ||
"babel-plugin-transform-es2015-modules-commonjs": "^6.22.0", | ||
"babel-polyfill": "^6.22.0", | ||
"babel-preset-latest": "^6.22.0", | ||
"babel-register": "^6.22.0" | ||
"babel-preset-latest": "^6.22.0" | ||
}, | ||
@@ -38,0 +35,0 @@ "engines": { |
3
5277
11
22