Skip to content

Commit

Permalink
Update standard and fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
simonratner committed Jul 28, 2017
1 parent 8b8e93b commit 2b948bd
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 21 deletions.
2 changes: 0 additions & 2 deletions lib/middlewares/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ var Parameters = require('../parameters')

module.exports = function () {
return function (req, res, next) {

/**
* Params data.
*/
Expand Down Expand Up @@ -63,4 +62,3 @@ module.exports = function () {
next()
}
}

1 change: 0 additions & 1 deletion lib/middlewares/koa.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ var Parameters = require('../parameters')

module.exports = function () {
return function (ctx, next) {

/**
* Params data.
*/
Expand Down
6 changes: 4 additions & 2 deletions lib/parameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ Object.assign(Parameters.prototype, {
* @api private
*/

_fetch: function (key) {return this._params[key] },
_fetch: function (key) { return this._params[key] },

/**
* Indicates if the key exists.
Expand Down Expand Up @@ -198,7 +198,9 @@ Object.assign(Parameters.prototype, {

_permitObject: function (params, filters) {
for (var key in filters) {
var param, isArrObj, filtersArray = filters[key]
var param
var isArrObj
var filtersArray = filters[key]
if (_.isArray(filtersArray) && (param = this._fetch(key))) {
if (_.isArray(param._params) || (isArrObj = Object.keys(param._params).every(function (i) { return !_.isNaN(Number(i)) }))) {
if (isArrObj) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"request": "^2.40.0",
"should": "^11.1.0",
"sinon": "^1.17.5",
"standard": "^3.0.0"
"standard": "^10.0.2"
},
"dependencies": {
"es6-object-assign": "^1.0.2",
Expand Down
2 changes: 0 additions & 2 deletions spec/middlewares/express.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,9 @@ describe('expressMiddleware', function () {
done(err)
})
})

})

describe('req.parameters.require()', function () {

it('should return a `params` object of the required key', function (done) {
ctx.app.use(function (req, res, next) {
res.json(req.parameters.require('p1').all())
Expand Down
7 changes: 0 additions & 7 deletions spec/middlewares/koa.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ describe('koaMiddleware', function () {
})

describe('req.parameters.all()', function () {

it('should return `all` params', function (done) {
ctx.app.use(function (ctx, next) {
ctx.body = ctx.parameters.all()
Expand All @@ -42,11 +41,9 @@ describe('koaMiddleware', function () {
done(err)
})
})

})

describe('req.parameters.permit()', function () {

it('should return `permit` selected params', function (done) {
ctx.app.use(function (ctx, next) {
ctx.body = ctx.parameters.permit('p1', 'a2').value()
Expand All @@ -58,11 +55,9 @@ describe('koaMiddleware', function () {
done(err)
})
})

})

describe('req.parameters.require()', function () {

it('should return a `params` object of the required key', function (done) {
ctx.app.use(function (ctx, next) {
ctx.body = ctx.parameters.require('p1').all()
Expand Down Expand Up @@ -95,7 +90,5 @@ describe('koaMiddleware', function () {
done(err)
})
})

})

})
6 changes: 0 additions & 6 deletions spec/parameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ var PRIMITIVE_TYPES = [Boolean, Number, String, function Null () {
}]

describe('Parameters', function () {

describe('class methods', function () {

describe('_initValue', function () {
PRIMITIVE_TYPES.forEach(function (Primitive) {
it('should return primitive for ' + Primitive.name, function () {
Expand Down Expand Up @@ -105,7 +103,6 @@ describe('Parameters', function () {
cb.callCount.should.equal(3)
}))
})

})

describe('instance methods', function () {
Expand All @@ -131,7 +128,6 @@ describe('Parameters', function () {
})

describe('operations', function () {

describe('constructing', function () {})
describe('cloning', function () {})
describe('whitelisting', function () {
Expand Down Expand Up @@ -312,7 +308,5 @@ describe('Parameters', function () {
})
})
})

})

})

0 comments on commit 2b948bd

Please sign in to comment.