Use object with null prototype for settings closes #4835

This commit is contained in:
Evan Hahn 2022-02-21 12:17:50 -06:00 committed by Wes Todd
parent 14439731f9
commit 26801a0afd

View File

@ -32,7 +32,6 @@ var setPrototypeOf = require('setprototypeof')
* @private
*/
var hasOwnProperty = Object.prototype.hasOwnProperty
var slice = Array.prototype.slice;
/**
@ -353,17 +352,7 @@ app.param = function param(name, fn) {
app.set = function set(setting, val) {
if (arguments.length === 1) {
// app.get(setting)
var settings = this.settings
while (settings && settings !== Object.prototype) {
if (hasOwnProperty.call(settings, setting)) {
return settings[setting]
}
settings = Object.getPrototypeOf(settings)
}
return undefined
return this.settings[setting];
}
debug('set "%s" to %o', setting, val);