src/merge-fields/worldKnowledge.js
Function valueCarriesMeaning
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
export function valueCarriesMeaning(tag, subfieldCode, value) {
// Some data is pretty meaningless and as meaningless is pretty close to nothing, this meaningless data should no prevent merge.
// The list below is incomples (swedish translations etc)
if (tag === '260' || tag === '264') {
// We drop these, instead of normalizing, as KV does not put this information in place...
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this function. Open
Open
return originalValue;
Avoid too many return
statements within this function. Open
Open
return originalValue;
Avoid too many return
statements within this function. Open
Open
return `3. painos`;
Avoid too many return
statements within this function. Open
Open
return `4. painos`;
Function normalizeEditionStatement
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
function normalizeEditionStatement(originalValue) {
const value = originalValue;
// As normalization tries to translate things info Finnish, use this for similarity check only!
if (value.match(/^[1-9][0-9]*(?:\.|:a|nd|rd|st|th) (?:ed\.?|edition|p\.?|painos|uppl\.?|upplagan)[.\]]*$/ui)) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"