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> {
Severity: Minor
Found in src/object/fromQueryString.ts - About 1 day to fix

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')
Severity: Minor
Found in src/object/equals.ts - About 1 day to fix

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

Severity: Minor
Found in src/array/equals.ts - About 3 hrs to fix

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 = '.',
Severity: Minor
Found in src/object/pathToObject.ts - About 3 hrs to fix

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
  }

Severity: Minor
Found in src/core/clone.ts - About 3 hrs to fix

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')
Severity: Major
Found in src/object/equals.ts - About 3 hrs to fix

    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
    Severity: Minor
    Found in src/object/defaults.ts - About 2 hrs to fix

    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>[] {
    Severity: Minor
    Found in src/object/toQueryObjects.ts - About 2 hrs to fix

    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.
    Severity: Critical
    Found in src/internal/arrayLikeKeys.ts - About 2 hrs to fix

      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) {
      Severity: Minor
      Found in src/object/removeEmpty.ts - About 2 hrs to fix

      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
      Severity: Major
      Found in src/object/equals.ts - About 2 hrs to fix

        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> {
        Severity: Minor
        Found in src/object/remove.ts - About 2 hrs to fix

        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,
        Severity: Minor
        Found in src/object/merge.ts - About 2 hrs to fix

        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) ||
        Severity: Critical
        Found in src/object/equals.ts - About 2 hrs to fix

          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 : {}),
            }
          Severity: Minor
          Found in src/core/match.ts - About 1 hr to fix

          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),
          Severity: Minor
          Found in src/internal/arrayLikeKeys.ts - About 1 hr to fix

          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>[] {
          Severity: Minor
          Found in src/object/toQueryObjects.ts - About 1 hr to fix

            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
              }
            
            
            Severity: Minor
            Found in src/core/clone.ts - About 1 hr to fix

              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
              Severity: Minor
              Found in .scripts/rename.ts - About 1 hr to fix

                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) {
                Severity: Minor
                Found in src/object/removeEmpty.ts - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language