@opra/common 1.0.0-alpha.5 → 1.0.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/browser.js CHANGED
@@ -2525,9 +2525,17 @@ var HttpControllerClass = class extends DocumentElement {
2525
2525
  return this.controllers.get(arg0);
2526
2526
  }
2527
2527
  findParameter(paramName, location) {
2528
- paramName = paramName.toLowerCase();
2529
- for (const prm of this.parameters) {
2530
- if ((!location || location === prm.location) && (prm.name instanceof RegExp && prm.name.test(paramName) || typeof prm.name === "string" && prm.name.toLowerCase() === paramName))
2528
+ const paramNameLower = paramName.toLowerCase();
2529
+ let prm;
2530
+ for (prm of this.parameters) {
2531
+ if (location && location !== prm.location)
2532
+ continue;
2533
+ if (typeof prm.name === "string") {
2534
+ prm._nameLower = prm._nameLower || prm.name.toLowerCase();
2535
+ if (prm._nameLower === paramNameLower)
2536
+ return prm;
2537
+ }
2538
+ if (prm.name instanceof RegExp && prm.name.test(paramName))
2531
2539
  return prm;
2532
2540
  }
2533
2541
  if (this.node.parent && this.node.parent.element instanceof HttpController2)
@@ -3140,9 +3148,17 @@ var HttpOperationClass = class extends DocumentElement {
3140
3148
  __name(this, "HttpOperationClass");
3141
3149
  }
3142
3150
  findParameter(paramName, location) {
3143
- paramName = paramName.toLowerCase();
3144
- for (const prm of this.parameters) {
3145
- if ((!location || location === prm.location) && (prm.name instanceof RegExp && prm.name.test(paramName) || prm.name === paramName))
3151
+ const paramNameLower = paramName.toLowerCase();
3152
+ let prm;
3153
+ for (prm of this.parameters) {
3154
+ if (location && location !== prm.location)
3155
+ continue;
3156
+ if (typeof prm.name === "string") {
3157
+ prm._nameLower = prm._nameLower || prm.name.toLowerCase();
3158
+ if (prm._nameLower === paramNameLower)
3159
+ return prm;
3160
+ }
3161
+ if (prm.name instanceof RegExp && prm.name.test(paramName))
3146
3162
  return prm;
3147
3163
  }
3148
3164
  }
@@ -82,11 +82,17 @@ class HttpControllerClass extends document_element_js_1.DocumentElement {
82
82
  return this.controllers.get(arg0);
83
83
  }
84
84
  findParameter(paramName, location) {
85
- paramName = paramName.toLowerCase();
86
- for (const prm of this.parameters) {
87
- if ((!location || location === prm.location) &&
88
- ((prm.name instanceof RegExp && prm.name.test(paramName)) ||
89
- (typeof prm.name === 'string' && prm.name.toLowerCase() === paramName)))
85
+ const paramNameLower = paramName.toLowerCase();
86
+ let prm;
87
+ for (prm of this.parameters) {
88
+ if (location && location !== prm.location)
89
+ continue;
90
+ if (typeof prm.name === 'string') {
91
+ prm._nameLower = prm._nameLower || prm.name.toLowerCase();
92
+ if (prm._nameLower === paramNameLower)
93
+ return prm;
94
+ }
95
+ if (prm.name instanceof RegExp && prm.name.test(paramName))
90
96
  return prm;
91
97
  }
92
98
  if (this.node.parent && this.node.parent.element instanceof exports.HttpController)
@@ -39,10 +39,17 @@ exports.HttpOperation = function (...args) {
39
39
  */
40
40
  class HttpOperationClass extends document_element_js_1.DocumentElement {
41
41
  findParameter(paramName, location) {
42
- paramName = paramName.toLowerCase();
43
- for (const prm of this.parameters) {
44
- if ((!location || location === prm.location) &&
45
- ((prm.name instanceof RegExp && prm.name.test(paramName)) || prm.name === paramName))
42
+ const paramNameLower = paramName.toLowerCase();
43
+ let prm;
44
+ for (prm of this.parameters) {
45
+ if (location && location !== prm.location)
46
+ continue;
47
+ if (typeof prm.name === 'string') {
48
+ prm._nameLower = prm._nameLower || prm.name.toLowerCase();
49
+ if (prm._nameLower === paramNameLower)
50
+ return prm;
51
+ }
52
+ if (prm.name instanceof RegExp && prm.name.test(paramName))
46
53
  return prm;
47
54
  }
48
55
  }
@@ -79,11 +79,17 @@ class HttpControllerClass extends DocumentElement {
79
79
  return this.controllers.get(arg0);
80
80
  }
81
81
  findParameter(paramName, location) {
82
- paramName = paramName.toLowerCase();
83
- for (const prm of this.parameters) {
84
- if ((!location || location === prm.location) &&
85
- ((prm.name instanceof RegExp && prm.name.test(paramName)) ||
86
- (typeof prm.name === 'string' && prm.name.toLowerCase() === paramName)))
82
+ const paramNameLower = paramName.toLowerCase();
83
+ let prm;
84
+ for (prm of this.parameters) {
85
+ if (location && location !== prm.location)
86
+ continue;
87
+ if (typeof prm.name === 'string') {
88
+ prm._nameLower = prm._nameLower || prm.name.toLowerCase();
89
+ if (prm._nameLower === paramNameLower)
90
+ return prm;
91
+ }
92
+ if (prm.name instanceof RegExp && prm.name.test(paramName))
87
93
  return prm;
88
94
  }
89
95
  if (this.node.parent && this.node.parent.element instanceof HttpController)
@@ -36,10 +36,17 @@ export const HttpOperation = function (...args) {
36
36
  */
37
37
  class HttpOperationClass extends DocumentElement {
38
38
  findParameter(paramName, location) {
39
- paramName = paramName.toLowerCase();
40
- for (const prm of this.parameters) {
41
- if ((!location || location === prm.location) &&
42
- ((prm.name instanceof RegExp && prm.name.test(paramName)) || prm.name === paramName))
39
+ const paramNameLower = paramName.toLowerCase();
40
+ let prm;
41
+ for (prm of this.parameters) {
42
+ if (location && location !== prm.location)
43
+ continue;
44
+ if (typeof prm.name === 'string') {
45
+ prm._nameLower = prm._nameLower || prm.name.toLowerCase();
46
+ if (prm._nameLower === paramNameLower)
47
+ return prm;
48
+ }
49
+ if (prm.name instanceof RegExp && prm.name.test(paramName))
43
50
  return prm;
44
51
  }
45
52
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/common",
3
- "version": "1.0.0-alpha.5",
3
+ "version": "1.0.0-alpha.6",
4
4
  "description": "Opra common package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -1,6 +1,5 @@
1
1
  import { Combine, StrictOmit, TypeThunkAsync } from 'ts-gems';
2
2
  import type { OpraSchema } from '../../schema/index.js';
3
- import { HttpParameterLocation } from '../../schema/types.js';
4
3
  import { DocumentElement } from '../common/document-element.js';
5
4
  import { Value } from '../common/value.js';
6
5
  import { DataType } from '../data-type/data-type.js';
@@ -46,7 +45,7 @@ declare class HttpParameterClass extends Value {
46
45
  deprecated?: boolean | string;
47
46
  required?: boolean;
48
47
  arraySeparator?: string;
49
- location: HttpParameterLocation;
48
+ location: OpraSchema.HttpParameterLocation;
50
49
  toJSON(): OpraSchema.HttpParameter;
51
50
  }
52
51
  export {};