acceptsLanguageOfferExtended() — fiber Function Reference
Architecture documentation for the acceptsLanguageOfferExtended() function in helpers.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD caf94e5f_a094_efb5_d604_9ddb963923db["acceptsLanguageOfferExtended()"] bec0e401_e4cd_f765_6df3_a79059073e50["helpers.go"] caf94e5f_a094_efb5_d604_9ddb963923db -->|defined in| bec0e401_e4cd_f765_6df3_a79059073e50 style caf94e5f_a094_efb5_d604_9ddb963923db fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
helpers.go lines 268–318
func acceptsLanguageOfferExtended(spec, offer string, _ headerParams) bool {
if spec == "*" {
return true
}
if spec == "" || offer == "" {
return false
}
// Use stack-allocated arrays to avoid heap allocations for typical language tags
var rsBuf, tsBuf [8]string
rs := rsBuf[:0]
ts := tsBuf[:0]
// Parse spec subtags without allocation for typical cases
for s := range strings.SplitSeq(spec, "-") {
rs = append(rs, s)
}
// Parse offer subtags without allocation for typical cases
for s := range strings.SplitSeq(offer, "-") {
ts = append(ts, s)
}
// Step 2: first subtag must match (or be '*')
if rs[0] != "*" && !utils.EqualFold(rs[0], ts[0]) {
return false
}
i, j := 1, 1 // i = range index, j = tag index
for i < len(rs) {
if rs[i] == "*" { // 3.A: '*' matches zero or more subtags
i++
continue
}
if j >= len(ts) { // 3.B: ran out of tag subtags
return false
}
if utils.EqualFold(rs[i], ts[j]) { // 3.C: exact subtag match
i++
j++
continue
}
// 3.D: singleton barrier (one letter or digit, incl. 'x')
if len(ts[j]) == 1 {
return false
}
// 3.E: slide forward in the tag and try again
j++
}
// 4: matched all range subtags
return true
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does acceptsLanguageOfferExtended() do?
acceptsLanguageOfferExtended() is a function in the fiber codebase, defined in helpers.go.
Where is acceptsLanguageOfferExtended() defined?
acceptsLanguageOfferExtended() is defined in helpers.go at line 268.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free