Aktueller Stand

This commit is contained in:
2026-01-22 19:05:45 +01:00
parent 85dee61a4d
commit e280e4eadb
1967 changed files with 397327 additions and 74093 deletions

View File

@@ -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)
}
}
}

View File

@@ -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 = {

View File

@@ -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
}