Skip to content

Question on code #10

@jswelsh

Description

@jswelsh

I'm trying to reason with this code, I know this is probably fairly obvious but I'm jr.dev 😝 so I have no idea.

in material-ui-filter/src/store/selectors.js line 46-55

  var sortOrder = sortOrientation ? 1 : -1

  return (x, y) => {
    var a = getValue(x, sortField, getSourceValue)
    var b = getValue(y, sortField, getSourceValue)
    var result = a < b ? -1 : a > b ? 1 : 0
    return result * sortOrder
  }
} 

the x, y doesn't reference anything in scope,
it's an anonymous function, providing undefined values... I Think. Shouldn't it always be undefined then? I've console.log() to try and peek inside but I still don't get it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions