src/notation-copy.js
Function notationCopy
has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring. Wontfix
Wontfix
function notationCopy (target, ...sources) {
let convertBuffer = false
if (typeof Buffer !== 'undefined') { convertBuffer = true }
const maxCalls = 2000
let calls
- 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
Function notationCopy
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Wontfix
Wontfix
function notationCopy (target, ...sources) {
let convertBuffer = false
if (typeof Buffer !== 'undefined') { convertBuffer = true }
const maxCalls = 2000
let calls
Function notationCopyRecursive
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Wontfix
Wontfix
function notationCopyRecursive (tgt, src) {
if (calls++ > maxCalls) { return }
if (src == null) { return src }
const type = typeof src
if (type === 'string' ||
Avoid too many return
statements within this function. Open
Open
return newArray
Avoid too many return
statements within this function. Wontfix
Wontfix
return undefined
Avoid too many return
statements within this function. Wontfix
Wontfix
return tgt
Avoid too many return
statements within this function. Open
Open
return result
Avoid too many return
statements within this function. Wontfix
Wontfix
return tgt
Avoid too many return
statements within this function. Wontfix
Wontfix
return src