my-idlers/node_modules/collect.js/docs/api/max.md
cp6 fd22b0bf58 V2 (Laravel re-make)
V2 (Laravel re-make)
2022-03-06 02:02:12 +11:00

409 B

max()

The max method returns the maximum value of a given key:

const collection = collect([
  {
    value: 10,
  },
  {
    value: -13,
  },
  {
    value: 12,
  },
  {
    unicorn: false,
  },
]);

const max = collection.max('value');

// 12
collect([-1, -2345, 12, 11, 3]).max();

// 12

View source on GitHub