Socket
Socket
Sign inDemoInstall

hapi-decorators

Package Overview
Dependencies
16
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.0 to 0.4.1

11

index.js

@@ -5,2 +5,3 @@ 'use strict'

var find = require('lodash.find')
var debug = require('debug')('hapi-decorators')
var routeMethods = {

@@ -23,2 +24,5 @@ get: 'get',

debug('Pre-trim baseUrl: %s', this.baseUrl)
debug('Post-trim baseUrl: %s', base)
if (!this.rawRoutes) {

@@ -33,2 +37,3 @@ return []

debug('Route path before merge with baseUrl: %s', route.path)
var url = (base + trimslash(route.path)) || '/'

@@ -46,2 +51,3 @@

function route (method, path) {
debug('@route (or alias) setup')
return function (target, key, descriptor) {

@@ -72,2 +78,3 @@ var targetName = target.constructor.name

function config (config) {
debug('@config setup')
return function (target, key, descriptor) {

@@ -85,2 +92,3 @@ setRoute(target, key, {

function validate (config) {
debug('@validate setup')
return function (target, key, descriptor) {

@@ -100,2 +108,3 @@ setRoute(target, key, {

function cache (cacheConfig) {
debug('@cache setup')
return function (target, key, descriptor) {

@@ -129,4 +138,6 @@ setRoute(target, key, {

if (found) {
debug('Subsequent configuration of route object for: %s', routeId)
extend(true, found, value)
} else {
debug('Initial setup of route object for: %s', routeId)
target.rawRoutes.push(extend(true, defaultRoute, value))

@@ -133,0 +144,0 @@ }

3

package.json
{
"name": "hapi-decorators",
"version": "0.4.0",
"version": "0.4.1",
"description": "",

@@ -27,2 +27,3 @@ "main": "index.js",

"dependencies": {
"debug": "^2.2.0",
"extend": "^3.0.0",

@@ -29,0 +30,0 @@ "lodash.find": "^3.2.1"

@@ -19,5 +19,11 @@ # hapi-decorators

```js
/*
* index.js
*
* Hapi initialization not shown, but `server` is the assumed
* instance;
*/
import {
controller,
get
get,
controller
} from 'hapi-decorators'

@@ -42,2 +48,14 @@

### Setup Babel
Run the above script with the following command, after installing [babel].
```no-highlight
babel-node --optional es7.decorators,es7.objectRestSpread index.js
```
Note: Decorators are currently unsupported in Babel 6. To work around that [issue]
use the [transform-decorators-legacy] plugin.
## Decorators

@@ -87,1 +105,5 @@

Cache settings for the route config object.
[babel]: https://www.npmjs.com/package/babel
[transform-decorators-legacy]: https://www.npmjs.com/package/babel-plugin-transform-decorators-legacy
[issue]: https://phabricator.babeljs.io/T2645
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc