eloqjs/collection

View on GitHub

Showing 7 of 8 total issues

Function getValue has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

function getValue(holder: Record<Key, unknown>, propParts: Key[]): unknown {
let result: unknown = holder
 
while (propParts.length && (isObject(result) || isArray(result))) {
const propPart = propParts.shift() as Key
Severity: Minor
Found in src/helpers/getProp.ts - About 1 hr to fix

Function resolveLikeOperation has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function resolveLikeOperation(value: string): RegExp {
switch (true) {
case value.startsWith('%') && value.endsWith('%'): {
const _value = extractValue('%(.*)%', value, 1)
return new RegExp(`^.*${_value}.*$`, 'i')
Severity: Minor
Found in src/helpers/where.ts - About 1 hr to fix

    Function compareValues has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function compareValues(
    property: unknown,
    value: unknown,
    operator: Operator
    ): boolean {
    Severity: Minor
    Found in src/helpers/where.ts - About 1 hr to fix

      Avoid too many return statements within this function.
      Open

      return new RegExp(`^${_value}.*$`, 'i')
      Severity: Major
      Found in src/helpers/where.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

        return new RegExp(`^${start}.*${end}$`, 'i')
        Severity: Major
        Found in src/helpers/where.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

          return new RegExp(`^.*${_value}$`, 'i')
          Severity: Major
          Found in src/helpers/where.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

            return new RegExp(`^.*${value}.*$`, 'i')
            Severity: Major
            Found in src/helpers/where.ts - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language