Showing 70 of 92 total issues
Function equals
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function equals(array1: any[], array2: any[]): boolean {
const length1 = array1.length
const length2 = array2.length
let i
Function camelCase
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
const camelCase = (input: string | string[], options?: CamelCaseType): string => {
options = {
pascalCase: false,
...(options ? options : {}),
}
Function defaults
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function defaults(
origin: Record<PropertyKey, any>,
...destinations: Record<PropertyKey, any>[]
): Record<PropertyKey, any> {
const ln = destinations.length
Function preserveCamelCase
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const preserveCamelCase = (value: string): string => {
let isLastCharLower = false
let isLastCharUpper = false
let isLastLastCharUpper = false
Function toQueryString
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export default function toQueryString(
object: Record<string, any>,
recursive: boolean = false,
options: ToQueryStringOptions = { encodeName: true }
) {
- 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 replaceByTemplate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function replaceByTemplate(str: string, map: Record<string, TextNumber>): string {
let cmpString = '',
offset = 0,
find = -1,
addString = ''
- 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 equals
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export default function equals(first: any, second: any): boolean {
if (first === second) {
return true
}
- 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 toNumber
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export default function toNumber(value: any): number {
if (typeof value === 'number') {
return value
}
- 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 toString
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export default function toString(value: any): string {
if (Array.isArray(value)) {
return value.toString()
}
- 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 merge
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function merge<T extends Partial<record>>(original: Partial<T>, ...values: Partial<T>[]): T {
const ln = values.length
let i = 0,
object: Partial<T>,
key: PropertyKey,
Function number
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export default function number(
value: TextNumber,
decimals: number = 2,
decPoint: string = '.',
thousandsSeparator: string = ',',
- 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 camelCase
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const camelCase = (input: string | string[], options?: CamelCaseType): string => {
options = {
pascalCase: false,
...(options ? options : {}),
}
- 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 intWord
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
value: TextNumber,
units: string[] = UnitsDefault,
kilo: number = 1000,
decimals: number = 2,
decPoint: string = '.',
Avoid deeply nested control flow statements. Open
if (j === subLn - 1) {
if (Array.isArray(temporary) && key === '') {
temporary.push(value)
} else {
temporary[key] = value
Function toArray
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export default function toArray(value: any = []): any[] {
if (isNil(value)) {
return []
}
- 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 toFinite
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export default function toFinite(value: any): number {
if (!value) {
return value === 0 ? value : 0
}
value = toNumber(value)
- 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 deeply nested control flow statements. Open
if (!Array.isArray(object[name])) {
object[name] = [object[name]]
}
Function fileSize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
size: TextNumber,
kilo: number = 1024,
decimals: number = 2,
decPoint: string = '.',
thousandsSeparator: string = ',',
Avoid deeply nested control flow statements. Open
if (!isEmpty(r)) {
a.push(r)
}
Function isEmpty
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export default function isEmpty(...parameters: any[]): boolean {
const invalid = parameters.some(parameter => {
switch (Object.prototype.toString.call(parameter)) {
case '[object String]':
if (parameter.trim().length) return true
- 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"