@hapi/call
Advanced tools
Comparing version 7.0.0 to 7.0.1
@@ -41,3 +41,3 @@ 'use strict'; | ||
if (isLiteral) { | ||
this._fulls = this._fulls || {}; | ||
this._fulls = this._fulls || new Map(); | ||
let literal = '/' + literals.join('/'); | ||
@@ -48,4 +48,4 @@ if (!record.settings.isCaseSensitive) { | ||
Hoek.assert(!this._fulls[literal], 'New route', record.path, 'conflicts with existing', this._fulls[literal] && this._fulls[literal].record.path); | ||
this._fulls[literal] = { segment: current, record }; | ||
Hoek.assert(!this._fulls.has(literal), 'New route', record.path, 'conflicts with existing', this._fulls.has(literal) && this._fulls.get(literal).record.path); | ||
this._fulls.set(literal, { segment: current, record }); | ||
} | ||
@@ -56,6 +56,9 @@ else if (current.literal !== undefined) { // Can be empty string | ||
this._literals = this._literals || {}; | ||
const currentLiteral = (record.settings.isCaseSensitive ? current.literal : current.literal.toLowerCase()); | ||
this._literals[currentLiteral] = this._literals[currentLiteral] || new internals.Segment(); | ||
this._literals[currentLiteral].add(remaining, record); | ||
this._literals = this._literals || new Map(); | ||
const currentLiteral = record.settings.isCaseSensitive ? current.literal : current.literal.toLowerCase(); | ||
if (!this._literals.has(currentLiteral)) { | ||
this._literals.set(currentLiteral, new internals.Segment()); | ||
} | ||
this._literals.get(currentLiteral).add(remaining, record); | ||
} | ||
@@ -130,7 +133,7 @@ else if (current.wildcard) { | ||
if (as.length !== bs.length) { | ||
return (as.length > bs.length ? aFirst : bFirst); | ||
return as.length > bs.length ? aFirst : bFirst; | ||
} | ||
if (as.first !== bs.first) { | ||
return (as.first ? bFirst : aFirst); | ||
return as.first ? bFirst : aFirst; | ||
} | ||
@@ -147,6 +150,6 @@ | ||
if (am.length === bm.length) { | ||
return (am > bm ? bFirst : aFirst); | ||
return am > bm ? bFirst : aFirst; | ||
} | ||
return (am.length < bm.length ? bFirst : aFirst); | ||
return am.length < bm.length ? bFirst : aFirst; | ||
} | ||
@@ -165,3 +168,3 @@ | ||
if (this._fulls) { | ||
match = this._fulls[options.isCaseSensitive ? path : path.toLowerCase()]; | ||
match = this._fulls.get(options.isCaseSensitive ? path : path.toLowerCase()); | ||
if (match) { | ||
@@ -176,7 +179,7 @@ return { record: match.record, array: [] }; | ||
const nextPath = path.slice(current.length + 1); | ||
const remainder = (segments.length > 1 ? segments.slice(1) : null); | ||
const remainder = segments.length > 1 ? segments.slice(1) : null; | ||
if (this._literals) { | ||
const literal = options.isCaseSensitive ? current : current.toLowerCase(); | ||
match = this._literals.hasOwnProperty(literal) && this._literals[literal]; | ||
match = this._literals.get(literal); | ||
if (match) { | ||
@@ -214,3 +217,3 @@ const record = internals.deeper(match, nextPath, remainder, [], options); | ||
if (current || | ||
(this._param._edge && this._param._edge.segment.empty)) { | ||
this._param._edge && this._param._edge.segment.empty) { | ||
@@ -217,0 +220,0 @@ const record = internals.deeper(this._param, nextPath, remainder, [current], options); |
{ | ||
"name": "@hapi/call", | ||
"description": "HTTP Router", | ||
"version": "7.0.0", | ||
"version": "7.0.1", | ||
"repository": "git://github.com/hapijs/call", | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22452
501