From: Justin Wind Date: Thu, 28 Apr 2022 23:00:20 +0000 (-0700) Subject: simplify parameter objects slightly X-Git-Tag: v1.2.6^2~3 X-Git-Url: http://git.squeep.com/?p=squeep-api-dingus;a=commitdiff_plain;h=ad464818fe8f839bea962f57bcdca4fe26c92ce7 simplify parameter objects slightly --- 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