Comparing version 17.4.0 to 17.5.0
@@ -119,10 +119,12 @@ 'use strict'; | ||
Hoek.assert(property, 'Missing decoration property name'); | ||
Hoek.assert(typeof property === 'string', 'Decoration property must be a string'); | ||
Hoek.assert(property[0] !== '_', 'Property name cannot begin with an underscore:', property); | ||
Hoek.assert(typeof property === 'string' || typeof property === 'symbol', 'Decoration property must be a string or a symbol'); | ||
const propertyName = property.toString(); | ||
Hoek.assert(propertyName[0] !== '_', 'Property name cannot begin with an underscore:', propertyName); | ||
const existing = this._core._decorations[type][property]; | ||
if (options.extend) { | ||
Hoek.assert(type !== 'handler', 'Cannot extent handler decoration:', property); | ||
Hoek.assert(existing, `Cannot extend missing ${type} decoration: ${property}`); | ||
Hoek.assert(typeof method === 'function', `Extended ${type} decoration method must be a function: ${property}`); | ||
Hoek.assert(type !== 'handler', 'Cannot extent handler decoration:', propertyName); | ||
Hoek.assert(existing, `Cannot extend missing ${type} decoration: ${propertyName}`); | ||
Hoek.assert(typeof method === 'function', `Extended ${type} decoration method must be a function: ${propertyName}`); | ||
@@ -132,3 +134,3 @@ method = method(existing); | ||
else { | ||
Hoek.assert(existing === undefined, `${type[0].toUpperCase() + type.slice(1)} decoration already defined: ${property}`); | ||
Hoek.assert(existing === undefined, `${type[0].toUpperCase() + type.slice(1)} decoration already defined: ${propertyName}`); | ||
} | ||
@@ -140,5 +142,5 @@ | ||
Hoek.assert(typeof method === 'function', 'Handler must be a function:', property); | ||
Hoek.assert(typeof method === 'function', 'Handler must be a function:', propertyName); | ||
Hoek.assert(!method.defaults || typeof method.defaults === 'object' || typeof method.defaults === 'function', 'Handler defaults property must be an object or function'); | ||
Hoek.assert(!options.extend, 'Cannot extend handler decoration:', property); | ||
Hoek.assert(!options.extend, 'Cannot extend handler decoration:', propertyName); | ||
} | ||
@@ -149,3 +151,3 @@ else if (type === 'request') { | ||
Hoek.assert(Request.reserved.indexOf(property) === -1, 'Cannot override built-in request interface decoration:', property); | ||
Hoek.assert(Request.reserved.indexOf(property) === -1, 'Cannot override built-in request interface decoration:', propertyName); | ||
@@ -164,3 +166,3 @@ if (options.apply) { | ||
Hoek.assert(this._core.toolkit.reserved.indexOf(property) === -1, 'Cannot override built-in toolkit decoration:', property); | ||
Hoek.assert(this._core.toolkit.reserved.indexOf(property) === -1, 'Cannot override built-in toolkit decoration:', propertyName); | ||
} | ||
@@ -171,3 +173,8 @@ else { | ||
Hoek.assert(Object.getOwnPropertyNames(internals.Server.prototype).indexOf(property) === -1, 'Cannot override the built-in server interface method:', property); | ||
if (typeof property === 'string') { | ||
Hoek.assert(Object.getOwnPropertyNames(internals.Server.prototype).indexOf(property) === -1, 'Cannot override the built-in server interface method:', propertyName); | ||
} | ||
else { | ||
Hoek.assert(Object.getOwnPropertySymbols(internals.Server.prototype).indexOf(property) === -1, 'Cannot override the built-in server interface method:', propertyName); | ||
} | ||
@@ -174,0 +181,0 @@ this._core.instances.forEach((server) => { |
@@ -5,3 +5,3 @@ { | ||
"homepage": "http://hapijs.com", | ||
"version": "17.4.0", | ||
"version": "17.5.0", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
@@ -13,3 +13,3 @@ <img src="https://raw.github.com/hapijs/hapi/master/images/17.png" align="right"/> | ||
Development version: **17.4.x** ([release notes](https://github.com/hapijs/hapi/issues?labels=release+notes&page=1&state=closed)) | ||
Development version: **17.5.x** ([release notes](https://github.com/hapijs/hapi/issues?labels=release+notes&page=1&state=closed)) | ||
[![Build Status](https://secure.travis-ci.org/hapijs/hapi.svg?branch=master)](http://travis-ci.org/hapijs/hapi) | ||
@@ -16,0 +16,0 @@ |
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
170096
4213