hapi-decorators
Advanced tools
Comparing version 0.2.1 to 0.2.2
16
index.js
@@ -14,3 +14,3 @@ 'use strict' | ||
exports.controller = function controller(baseUrl) { | ||
exports.controller = function controller (baseUrl) { | ||
return function (target) { | ||
@@ -20,12 +20,14 @@ target.prototype.baseUrl = baseUrl | ||
target.prototype.routes = function () { | ||
var self = this | ||
var base = trimslash(this.baseUrl) | ||
if (!this.rawRoutes) { | ||
return; | ||
return | ||
} | ||
return this.rawRoutes.map(function (route) { | ||
var url = (base + trimslash(route.path)) || '/'; | ||
var url = (base + trimslash(route.path)) || '/' | ||
route.path = url | ||
route.config.bind = self | ||
@@ -38,3 +40,3 @@ return route | ||
function route(method, path) { | ||
function route (method, path) { | ||
return function (target, key, descriptor) { | ||
@@ -61,3 +63,3 @@ setRoute(target, key, { | ||
function validate(config) { | ||
function validate (config) { | ||
return function (target, key, descriptor) { | ||
@@ -76,3 +78,3 @@ setRoute(target, key, { | ||
function setRoute(target, key, value) { | ||
function setRoute (target, key, value) { | ||
if (!target.rawRoutes) { | ||
@@ -98,3 +100,3 @@ target.rawRoutes = [] | ||
function trimslash(s) { | ||
function trimslash (s) { | ||
return s[s.length - 1] === '/' | ||
@@ -101,0 +103,0 @@ ? s.slice(0, s.length - 1) |
{ | ||
"name": "hapi-decorators", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"lint": "snazzy index.js", | ||
"test": "node test | tap-spec", | ||
"posttest": "npm run lint", | ||
"coverage": "babel-node node_modules/.bin/isparta cover test/*.js", | ||
"coveralls": "npm run coverage -s && coveralls < coverage/lcov.info", | ||
"postcoveralls": "rimraf ./coverage" | ||
}, | ||
"author": "Ilya Radchenko <ilya@burstcreations.com> (https://github.com/knownasilya)", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/knownasilya/hapi-decorators.git" | ||
}, | ||
"license": "ISC", | ||
@@ -14,3 +23,11 @@ "dependencies": { | ||
"lodash.find": "^3.2.1" | ||
}, | ||
"devDependencies": { | ||
"babel": "^5.8.23", | ||
"coveralls": "^2.11.4", | ||
"rimraf": "^2.4.3", | ||
"snazzy": "^2.0.1", | ||
"tap-spec": "^4.1.0", | ||
"tape": "^4.2.0" | ||
} | ||
} |
@@ -8,2 +8,6 @@ # hapi-decorators | ||
[![npm version](https://badge.fury.io/js/hapi-decorators.svg)](http://badge.fury.io/js/hapi-decorators) | ||
[![Build Status](https://travis-ci.org/knownasilya/hapi-decorators.svg)](https://travis-ci.org/knownasilya/hapi-decorators) | ||
[![Coverage Status](https://coveralls.io/repos/knownasilya/hapi-decorators/badge.svg?branch=master&service=github)](https://coveralls.io/github/knownasilya/hapi-decorators?branch=master) | ||
## Usage | ||
@@ -26,3 +30,3 @@ | ||
} | ||
@get('/world') | ||
@@ -29,0 +33,0 @@ sayHello(request, reply) { |
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
6007
7
113
2
84
0
6