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

Severity: Minor
Found in src/array/equals.ts - About 1 hr to fix

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

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

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

          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()
            }
          
          
          Severity: Minor
          Found in src/to/toString.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 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
            }
          
          
          Severity: Minor
          Found in src/core/equals.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 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 = ''
          Severity: Minor
          Found in src/string/strtr.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 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
            }
          
          
          Severity: Minor
          Found in src/to/toNumber.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 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 }
          ) {
          Severity: Minor
          Found in src/object/toQueryString.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 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,
          Severity: Minor
          Found in src/object/merge.ts - About 1 hr to fix

            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 = ',',
            Severity: Minor
            Found in src/format/number.ts - About 55 mins 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 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 : {}),
              }
            Severity: Minor
            Found in src/string/camelCase.ts - About 55 mins 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 intWord has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              value: TextNumber,
              units: string[] = UnitsDefault,
              kilo: number = 1000,
              decimals: number = 2,
              decPoint: string = '.',
            Severity: Major
            Found in src/format/intWord.ts - About 50 mins to fix

              Function fileSize has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                size: TextNumber,
                kilo: number = 1024,
                decimals: number = 2,
                decPoint: string = '.',
                thousandsSeparator: string = ',',
              Severity: Minor
              Found in src/format/fileSize.ts - About 45 mins to fix

                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 []
                  }
                
                
                Severity: Minor
                Found in src/to/toArray.ts - About 45 mins 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

                Avoid deeply nested control flow statements.
                Open

                          if (j === subLn - 1) {
                            if (Array.isArray(temporary) && key === '') {
                              temporary.push(value)
                            } else {
                              temporary[key] = value
                Severity: Major
                Found in src/object/fromQueryString.ts - About 45 mins to fix

                  Function readdirP has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                  async function* readdirP(dir: string): AsyncGenerator<string> {
                    for (const entry of await fs.readdir(dir, { withFileTypes: true })) {
                      if (entry.isDirectory()) {
                        for await (const sub of readdirP(path.join(dir, entry.name))) {
                          yield sub
                  Severity: Minor
                  Found in .scripts/rename.ts - About 45 mins 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

                  Avoid deeply nested control flow statements.
                  Open

                            if (!Array.isArray(object[name])) {
                              object[name] = [object[name]]
                            }
                  Severity: Major
                  Found in src/object/fromQueryString.ts - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                if (!isEmpty(r)) {
                                  a.push(r)
                                }
                    Severity: Major
                    Found in src/object/removeEmpty.ts - About 45 mins to fix

                      Function sum has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export default function sum(object: Record<PropertyKey, TextNumber | boolean | Function>): number {
                        let result = 0
                        for (const key in object) {
                          let value = object[key]
                          if (value instanceof Function) {
                      Severity: Minor
                      Found in src/object/sum.ts - About 45 mins 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

                      Severity
                      Category
                      Status
                      Source
                      Language