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

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