MCPcopy Create free account
hub / github.com/flatlogic/react-material-admin / applySorting

Function applySorting

src/repositories/usersMockRepository.js:354–363  ·  view source on GitHub ↗
(users, orderBy)

Source from the content-addressed store, hash-verified

352}
353
354function applySorting(users, orderBy) {
355 if (!orderBy) {
356 return users;
357 }
358
359 return [...users].sort((left, right) => {
360 const direction = orderBy.sort === 'asc' ? 1 : -1;
361 return compareValues(left[orderBy.field], right[orderBy.field]) * direction;
362 });
363}
364
365function applyPagination(users, filter, requestQuery) {
366 const limit = toPositiveInteger(filter.limit ?? pickQueryValue(requestQuery.limit), 10);

Callers 1

listMockUsersFunction · 0.85

Calls 1

compareValuesFunction · 0.85

Tested by

no test coverage detected