Implementing tree sorting without creating extra function

I have a function which sorts my data tree according to it’s items order

  const itemSorter = (items) =>
  items
    .map((item) => (item?.children ? { ...item, children: itemSorter(item.children) } : item))
    .sort((i1, i2) => i1.order - i2.order);

 sortItems(dataTree);

So my question is:
Is it possible to implement the same logic without creating function itemSorter, just start with

retun dataTree.map(.... and so on) 

or that’s impossible when we use recursion and we always need the name?