Showing 70 of 92 total issues
Function fromQueryString
has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring. Open
export default function fromQueryString(
queryString: string,
recursive: boolean = false,
options: FromQueryStringOptions = { decodeName: true }
): Record<string, any> {
- 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 equal
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
export default function equal(origin: Record<PropertyKey, any>, ...list: Record<PropertyKey, any>[]): boolean {
let i: number, l: number, leftChain: Array<any>, rightChain: Array<any>
if (!isObject(origin) || list.length === 0) {
throw new Error('Need two or more arguments to compare')
- 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 24 (exceeds 5 allowed). Consider refactoring. Open
export default function equals(array1: any[], array2: any[]): boolean {
const length1 = array1.length
const length2 = array2.length
let i
- 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 pathToObject
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
export default function pathToObject(
paths: string = '',
value: any = null,
object: Record<PropertyKey, any> = {},
divider: 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 clone
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
export default function clone<T = NonNullable<any>>(item: T, cloneDom: boolean = true): T {
if (item === null || item === undefined) {
return item
}
- 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 equal
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function equal(origin: Record<PropertyKey, any>, ...list: Record<PropertyKey, any>[]): boolean {
let i: number, l: number, leftChain: Array<any>, rightChain: Array<any>
if (!isObject(origin) || list.length === 0) {
throw new Error('Need two or more arguments to compare')
Function defaults
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
export default function defaults(
origin: Record<PropertyKey, any>,
...destinations: Record<PropertyKey, any>[]
): Record<PropertyKey, any> {
const ln = destinations.length
- 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 toQueryObjects
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
export default function toQueryObjects(
name: string,
value: oType | oTypeArray,
recursive: boolean = false
): Record<string, any>[] {
- 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
Consider simplifying this complex logical expression. Open
if (
(inherited || hasOwnProperty.call(value, key)) &&
!(
skipIndexes &&
// Safari 9 has enumerable `arguments.length` in strict mode.
Function removeEmpty
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
export default function removeEmpty(object: Record<PropertyKey, any>): Record<PropertyKey, any> {
let result: Record<PropertyKey, any> = {},
key: PropertyKey
for (key in object) {
- 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 compare2Objects
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
function compare2Objects(x: any, y: any) {
let p
// remember that NaN === NaN returns false
// and isNaN(undefined) returns true
Function remove
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
export default function remove(
object: Record<PropertyKey, any>,
selector: string | string[],
divider: string = '.'
): Record<PropertyKey, any> {
- 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 a Cognitive Complexity of 17 (exceeds 5 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,
- 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
Consider simplifying this complex logical expression. Open
if (
(typeof x === 'function' && typeof y === 'function') ||
(x instanceof Date && y instanceof Date) ||
(x instanceof RegExp && y instanceof RegExp) ||
(x instanceof String && y instanceof String) ||
Function match
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export default function match(expr: any, cases: casesType, options?: matchOptions): any {
const opt = {
strict: true,
...(isObject(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 arrayLikeKeys
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export default function arrayLikeKeys(value: any, inherited: boolean = false): string[] {
const isArray_ = Array.isArray(value),
isArgument = !isArray_ && isArguments(value),
isBuff = !isArray_ && !isArgument && isBuffer(value),
isType = !isArray_ && !isArgument && !isBuff && isTypedArray(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 toQueryObjects
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function toQueryObjects(
name: string,
value: oType | oTypeArray,
recursive: boolean = false
): Record<string, any>[] {
Function clone
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function clone<T = NonNullable<any>>(item: T, cloneDom: boolean = true): T {
if (item === null || item === undefined) {
return item
}
Function main
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function main(): Promise<void> {
for await (const entry of readdirP(path.relative(process.cwd(), path.join(__dirname, '..', 'dist/esm')))) {
const match = /^(.*)(\.(js|js\.map|d\.ts))$/.exec(entry)
if (match == null) {
continue
Function removeEmpty
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function removeEmpty(object: Record<PropertyKey, any>): Record<PropertyKey, any> {
let result: Record<PropertyKey, any> = {},
key: PropertyKey
for (key in object) {