From ad464818fe8f839bea962f57bcdca4fe26c92ce7 Mon Sep 17 00:00:00 2001 From: Justin Wind Date: Thu, 28 Apr 2022 16:00:20 -0700 Subject: [PATCH] simplify parameter objects slightly --- lib/router/path-parameter.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/lib/router/path-parameter.js b/lib/router/path-parameter.js index 585aaec..3c6f1cb 100644 --- a/lib/router/path-parameter.js +++ b/lib/router/path-parameter.js @@ -1,6 +1,5 @@ 'use strict'; -const kPathParameter = Symbol('kSqueepDingusRouterPathParameter'); const parameters = new Map(); /** * De-duplicating factory of minimal-objects to track the named-parameter parts of path definitions. @@ -16,24 +15,17 @@ class PathParameter extends null { return parameters.get(parameter); } const pathParameter = Object.create(PathParameter.prototype); - pathParameter[kPathParameter] = parameter; // eslint-disable-line security/detect-object-injection + pathParameter.parameter = parameter; parameters.set(parameter, pathParameter); Object.freeze(pathParameter); return pathParameter; } - /** - * Return the parameter name. - */ - get parameter() { - return this[kPathParameter];// eslint-disable-line security/detect-object-injection - } - /** * @returns {String} */ toString() { - return `{${this.constructor.name} ${this.parameter}}`; // eslint-disable-line security/detect-object-injection + return `{${this.constructor.name} ${this.parameter}}`; } /** @@ -43,7 +35,6 @@ class PathParameter extends null { this.parameters.clear(); } } -PathParameter.kPathParameter = kPathParameter; PathParameter.parameters = parameters; module.exports = PathParameter; \ No newline at end of file -- 2.45.2