Aktueller Stand
This commit is contained in:
6
backend/node_modules/find-my-way/lib/strategies/accept-host.js
generated
vendored
6
backend/node_modules/find-my-way/lib/strategies/accept-host.js
generated
vendored
@@ -2,11 +2,11 @@
|
||||
const assert = require('node:assert')
|
||||
|
||||
function HostStorage () {
|
||||
const hosts = {}
|
||||
const hosts = new Map()
|
||||
const regexHosts = []
|
||||
return {
|
||||
get: (host) => {
|
||||
const exact = hosts[host]
|
||||
const exact = hosts.get(host)
|
||||
if (exact) {
|
||||
return exact
|
||||
}
|
||||
@@ -20,7 +20,7 @@ function HostStorage () {
|
||||
if (host instanceof RegExp) {
|
||||
regexHosts.push({ host, value })
|
||||
} else {
|
||||
hosts[host] = value
|
||||
hosts.set(host, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
23
backend/node_modules/find-my-way/lib/strategies/accept-version.js
generated
vendored
23
backend/node_modules/find-my-way/lib/strategies/accept-version.js
generated
vendored
@@ -7,8 +7,7 @@ function SemVerStore () {
|
||||
return new SemVerStore()
|
||||
}
|
||||
|
||||
this.store = {}
|
||||
|
||||
this.store = new Map()
|
||||
this.maxMajor = 0
|
||||
this.maxMinors = {}
|
||||
this.maxPatches = {}
|
||||
@@ -18,7 +17,7 @@ SemVerStore.prototype.set = function (version, store) {
|
||||
if (typeof version !== 'string') {
|
||||
throw new TypeError('Version should be a string')
|
||||
}
|
||||
let [major, minor, patch] = version.split('.')
|
||||
let [major, minor, patch] = version.split('.', 3)
|
||||
|
||||
if (isNaN(major)) {
|
||||
throw new TypeError('Major version must be a numeric value')
|
||||
@@ -30,29 +29,29 @@ SemVerStore.prototype.set = function (version, store) {
|
||||
|
||||
if (major >= this.maxMajor) {
|
||||
this.maxMajor = major
|
||||
this.store.x = store
|
||||
this.store['*'] = store
|
||||
this.store['x.x'] = store
|
||||
this.store['x.x.x'] = store
|
||||
this.store.set('x', store)
|
||||
this.store.set('*', store)
|
||||
this.store.set('x.x', store)
|
||||
this.store.set('x.x.x', store)
|
||||
}
|
||||
|
||||
if (minor >= (this.maxMinors[major] || 0)) {
|
||||
this.maxMinors[major] = minor
|
||||
this.store[`${major}.x`] = store
|
||||
this.store[`${major}.x.x`] = store
|
||||
this.store.set(`${major}.x`, store)
|
||||
this.store.set(`${major}.x.x`, store)
|
||||
}
|
||||
|
||||
if (patch >= (this.maxPatches[`${major}.${minor}`] || 0)) {
|
||||
this.maxPatches[`${major}.${minor}`] = patch
|
||||
this.store[`${major}.${minor}.x`] = store
|
||||
this.store.set(`${major}.${minor}.x`, store)
|
||||
}
|
||||
|
||||
this.store[`${major}.${minor}.${patch}`] = store
|
||||
this.store.set(`${major}.${minor}.${patch}`, store)
|
||||
return this
|
||||
}
|
||||
|
||||
SemVerStore.prototype.get = function (version) {
|
||||
return this.store[version]
|
||||
return this.store.get(version)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
||||
9
backend/node_modules/find-my-way/lib/strategies/http-method.js
generated
vendored
9
backend/node_modules/find-my-way/lib/strategies/http-method.js
generated
vendored
@@ -3,12 +3,13 @@
|
||||
module.exports = {
|
||||
name: '__fmw_internal_strategy_merged_tree_http_method__',
|
||||
storage: function () {
|
||||
const handlers = {}
|
||||
const handlers = new Map()
|
||||
return {
|
||||
get: (type) => { return handlers[type] || null },
|
||||
set: (type, store) => { handlers[type] = store }
|
||||
get: (type) => { return handlers.get(type) || null },
|
||||
set: (type, store) => { handlers.set(type, store) }
|
||||
}
|
||||
},
|
||||
deriveConstraint: /* istanbul ignore next */ (req) => req.method,
|
||||
/* c8 ignore next 1 */
|
||||
deriveConstraint: (req) => req.method,
|
||||
mustMatchWhenDerived: true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user